Class: Unit::Types::RelationshipArray
- Inherits:
-
Object
- Object
- Unit::Types::RelationshipArray
- Defined in:
- lib/unit/types/relationship_array.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(array) ⇒ RelationshipArray
constructor
A new instance of RelationshipArray.
- #represent ⇒ Object
Constructor Details
#initialize(array) ⇒ RelationshipArray
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/unit/types/relationship_array.rb', line 10 def initialize(array) relationships = [] array.map do |item| relationships << if item.is_a?(Relationship) item else Relationship.new(item[:data][:id], item[:data][:type]).represent end p item end @data = relationships end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/unit/types/relationship_array.rb', line 7 def data @data end |
Instance Method Details
#represent ⇒ Object
23 24 25 |
# File 'lib/unit/types/relationship_array.rb', line 23 def represent { "data": data } end |