Class: CollectionJSON::Item
- Inherits:
-
Hash
- Object
- Hash
- CollectionJSON::Item
- Defined in:
- lib/collection-json/attributes/item.rb
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
- #data=(array) ⇒ Object
- #href ⇒ Object
- #href=(value) ⇒ Object
- #links ⇒ Object
- #links=(array) ⇒ Object
Class Method Details
.from_hash(hash) ⇒ Object
6 7 8 |
# File 'lib/collection-json/attributes/item.rb', line 6 def self.from_hash(hash) self.new.merge! hash end |
Instance Method Details
#data ⇒ Object
21 22 23 |
# File 'lib/collection-json/attributes/item.rb', line 21 def data self['data'].map {|data| Data.from_hash(data)} end |
#data=(array) ⇒ Object
25 26 27 |
# File 'lib/collection-json/attributes/item.rb', line 25 def data=(array) self['data'] = array end |
#href ⇒ Object
10 |
# File 'lib/collection-json/attributes/item.rb', line 10 def href; self['href']; end |
#href=(value) ⇒ Object
11 |
# File 'lib/collection-json/attributes/item.rb', line 11 def href=(value); self['href'] = value; end |
#links ⇒ Object
13 14 15 |
# File 'lib/collection-json/attributes/item.rb', line 13 def links self['links'].map {|link| Link.from_hash(link)} end |
#links=(array) ⇒ Object
17 18 19 |
# File 'lib/collection-json/attributes/item.rb', line 17 def links=(array) self['links'] = array end |