Class: OPDS::AcquisitionFeed
Overview
Represents an acquisition feed
Instance Attribute Summary
Attributes inherited from Feed
Instance Method Summary collapse
-
#active_facets ⇒ Hash
Get a collection of active_facets by opds:facetGroup.
-
#facets ⇒ Hash
Get a collection of facets groupped by opds:facetGroup.
Methods inherited from Feed
#author, #first_page?, from_nokogiri, #icon, #id, #initialize, #inspect, #last_page?, #links, #next_page, #next_page_url, #paginated?, parse_raw, parse_url, #prev_page, #prev_page_url, #serialize!, #title
Methods included from Logging
Constructor Details
This class inherits a constructor from OPDS::Feed
Instance Method Details
#active_facets ⇒ Hash
Get a collection of active_facets by opds:facetGroup
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/opds/acquisition_feed.rb', line 21 def active_facets return @selected if @selected @selected={} facets.each do |k,v| @selected[k]=nil v.each do |f| @selected[k]=f if f.active_facet? end end @selected end |
#facets ⇒ Hash
Get a collection of facets groupped by opds:facetGroup
8 9 10 11 12 13 14 15 16 |
# File 'lib/opds/acquisition_feed.rb', line 8 def facets return @facets if @facets @facets={} links['http://opds-spec.org/facet'].each do |facet| @facets[facet.facet_group]||=[] @facets[facet.facet_group].push facet end @facets end |