Class: OPDS::AcquisitionFeed

Inherits:
Feed
  • Object
show all
Defined in:
lib/opds/acquisition_feed.rb

Overview

Represents an acquisition feed

Instance Attribute Summary

Attributes inherited from Feed

#entries, #raw_doc

Instance Method Summary collapse

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

#log, log

Constructor Details

This class inherits a constructor from OPDS::Feed

Instance Method Details

#active_facetsHash

Get a collection of active_facets by opds:facetGroup

Returns:

  • (Hash)

    active facets



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

#facetsHash

Get a collection of facets groupped by opds:facetGroup

Returns:

  • (Hash)

    facets



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