Class: JSONAPI::Ruby::Deserializer::Relationships
- Inherits:
-
Object
- Object
- JSONAPI::Ruby::Deserializer::Relationships
- Includes:
- Parser
- Defined in:
- lib/jsonapi-ruby-deserializer/relationships.rb
Instance Attribute Summary collapse
-
#to_a ⇒ Object
Returns the value of attribute to_a.
Instance Method Summary collapse
-
#initialize(data) ⇒ Relationships
constructor
A new instance of Relationships.
Methods included from Parser
#method_missing, #parse!, #to_h
Constructor Details
#initialize(data) ⇒ Relationships
Returns a new instance of Relationships.
12 13 14 15 16 17 18 19 |
# File 'lib/jsonapi-ruby-deserializer/relationships.rb', line 12 def initialize(data) @to_a = [] data.map do |key, h| @to_a << key self.class.send(:attr_accessor, key) instance_variable_set("@#{key}", Document.new(h)) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JSONAPI::Ruby::Deserializer::Parser
Instance Attribute Details
#to_a ⇒ Object
Returns the value of attribute to_a.
10 11 12 |
# File 'lib/jsonapi-ruby-deserializer/relationships.rb', line 10 def to_a @to_a end |