Module: GreenButtonData::Relations
- Included in:
- Fetchable::ClassMethods
- Defined in:
- lib/green-button-data/relations.rb
Instance Method Summary collapse
- #construct_links_hash(entry) ⇒ Object
-
#construct_related_urls(entry) ⇒ Object
Extracts related URLs from an Entry.
Instance Method Details
#construct_links_hash(entry) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/green-button-data/relations.rb', line 24 def construct_links_hash(entry) { related: entry., self: entry.self, up: entry.up } end |
#construct_related_urls(entry) ⇒ Object
Extracts related URLs from an Entry
Arguments
-
entry- An instance of GreenButtonData::Parser::Entry
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/green-button-data/relations.rb', line 10 def (entry) = {} entry..each do || match_data = /\/(\w+)(\/(\d+))*$/.match() unless match_data.nil? [:"#{match_data[1].underscore}"] = end end end |