Class: Typelizer::SerializerPlugins::Panko

Inherits:
Base
  • Object
show all
Defined in:
lib/typelizer/serializer_plugins/panko.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #meta_fields, #root_key

Constructor Details

This class inherits a constructor from Typelizer::SerializerPlugins::Base

Instance Method Details

#propertiesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/typelizer/serializer_plugins/panko.rb', line 6

def properties
  descriptor = serializer.new.instance_variable_get(:@descriptor)
  attributes = descriptor.attributes
  methods_attributes = descriptor.method_fields
  has_many_associations = descriptor.has_many_associations
  has_one_associations = descriptor.has_one_associations

  attributes.map do |att|
    attribute_property(att)
  end + methods_attributes.map do |att|
    attribute_property(att)
  end + has_many_associations.map do |assoc|
    association_property(assoc, multi: true)
  end + has_one_associations.map do |assoc|
    association_property(assoc, multi: false)
  end
end