Class: HypermediaMapper::LinkCollection
- Inherits:
-
Object
- Object
- HypermediaMapper::LinkCollection
- Includes:
- Enumerable
- Defined in:
- lib/hypermedia_mapper/link_collection.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #fetch(relationship) ⇒ Object
-
#initialize(options = {}) ⇒ LinkCollection
constructor
A new instance of LinkCollection.
Constructor Details
#initialize(options = {}) ⇒ LinkCollection
Returns a new instance of LinkCollection.
5 6 7 8 |
# File 'lib/hypermedia_mapper/link_collection.rb', line 5 def initialize(={}) @raw_links = [:items] @parser_class = [:parser] || LinkParser end |
Instance Method Details
#each(&block) ⇒ Object
14 15 16 |
# File 'lib/hypermedia_mapper/link_collection.rb', line 14 def each(&block) items.each(&block) end |
#fetch(relationship) ⇒ Object
10 11 12 |
# File 'lib/hypermedia_mapper/link_collection.rb', line 10 def fetch(relationship) find { |i| i.rel == relationship.to_s } end |