Module: JSONAPI::Attributes::ClassMethods
- Defined in:
- lib/jsonapi-serializers/attributes.rb
Instance Attribute Summary collapse
-
#attributes_map ⇒ Object
Returns the value of attribute attributes_map.
-
#to_many_associations ⇒ Object
Returns the value of attribute to_many_associations.
-
#to_one_associations ⇒ Object
Returns the value of attribute to_one_associations.
Instance Method Summary collapse
- #attribute(name, options = {}, &block) ⇒ Object
- #attributes(*names) ⇒ Object
- #has_many(name, options = {}, &block) ⇒ Object
- #has_one(name, options = {}, &block) ⇒ Object
Instance Attribute Details
#attributes_map ⇒ Object
Returns the value of attribute attributes_map.
23 24 25 |
# File 'lib/jsonapi-serializers/attributes.rb', line 23 def attributes_map @attributes_map end |
#to_many_associations ⇒ Object
Returns the value of attribute to_many_associations.
25 26 27 |
# File 'lib/jsonapi-serializers/attributes.rb', line 25 def to_many_associations @to_many_associations end |
#to_one_associations ⇒ Object
Returns the value of attribute to_one_associations.
24 25 26 |
# File 'lib/jsonapi-serializers/attributes.rb', line 24 def to_one_associations @to_one_associations end |
Instance Method Details
#attribute(name, options = {}, &block) ⇒ Object
27 28 29 |
# File 'lib/jsonapi-serializers/attributes.rb', line 27 def attribute(name, = {}, &block) add_attribute(name, , &block) end |
#attributes(*names) ⇒ Object
31 32 33 |
# File 'lib/jsonapi-serializers/attributes.rb', line 31 def attributes(*names) names.each { |name| add_attribute(name) } end |
#has_many(name, options = {}, &block) ⇒ Object
39 40 41 |
# File 'lib/jsonapi-serializers/attributes.rb', line 39 def has_many(name, = {}, &block) add_to_many_association(name, , &block) end |
#has_one(name, options = {}, &block) ⇒ Object
35 36 37 |
# File 'lib/jsonapi-serializers/attributes.rb', line 35 def has_one(name, = {}, &block) add_to_one_association(name, , &block) end |