lib/apia/field_set.rb
# Generate a default field spec for this field set based on the values
# provided for the include option.
#
# @return [FieldSpec]
Generate a default field spec for this field set based on the values
provided for the include option.
Generate a default field spec for this field set based on the values provided for the include option .
def spec
      @spec ||= begin
        spec = each_with_object([]) do |(key, field), array|
          next if field.include == false
          if field.include.is_a?(::String)
            array << "#{key}[#{field.include}]"
          elsif field.type.object? || field.type.polymorph?
            array << "#{key}[*]"
          else
            array << key
          end
        end.join(',')
        FieldSpec.parse(spec)
      end
    end
def spec @spec ||= begin spec = each_with_object ( [ ] ) do | ( key , field ) , array | next if field . include == false if field . include . is_a? ( :: String ) array << "#{key}[#{field.include}]" elsif field . type . object? || field . type . polymorph? array << "#{key}[*]" else array << key end end . join ( ',' ) FieldSpec . parse ( spec ) end end
Generate a default field spec for this field set based on the values
provided for the include option.
Generate a default field spec for this field set based on the values provided for the include option .
None
FieldSpec