Class: Exlibris::Primo::Facet
- Inherits:
-
Object
- Object
- Exlibris::Primo::Facet
- Includes:
- Config::Attributes, WriteAttributes, XmlUtil
- Defined in:
- lib/exlibris/primo/facet.rb
Overview
Primo facet holds the name of the facet and size (often approximate).
Instance Attribute Summary collapse
-
#accurate ⇒ Object
(also: #accurate?)
Returns the value of attribute accurate.
Instance Method Summary collapse
- #display_name ⇒ Object
- #facet_values ⇒ Object
-
#initialize(*args) ⇒ Facet
constructor
A new instance of Facet.
- #name ⇒ Object
- #size ⇒ Object (also: #count)
Methods included from XmlUtil
included, #to_hash, #to_json, #to_xml
Methods included from WriteAttributes
Methods included from Config::Attributes
#availability_statuses, #base_url, #config, #facet_collections, #facet_labels, #facet_resource_types, #facet_top_level, #institution, #institutions, #libraries, #proxy_url, #sources
Constructor Details
#initialize(*args) ⇒ Facet
Returns a new instance of Facet.
15 16 17 18 |
# File 'lib/exlibris/primo/facet.rb', line 15 def initialize *args @raw_xml = args.last.delete(:raw_xml) super end |
Instance Attribute Details
#accurate ⇒ Object Also known as: accurate?
Returns the value of attribute accurate.
12 13 14 |
# File 'lib/exlibris/primo/facet.rb', line 12 def accurate @accurate end |
Instance Method Details
#display_name ⇒ Object
24 25 26 |
# File 'lib/exlibris/primo/facet.rb', line 24 def display_name @display_name ||= (config.facet_labels[name] || name) end |
#facet_values ⇒ Object
33 34 35 36 37 |
# File 'lib/exlibris/primo/facet.rb', line 33 def facet_values @facet_values ||= xml.root.search("//FACET_VALUES").collect do |facet_value| FacetValue.new(:raw_xml => facet_value.to_xml, :facet => self) end end |
#name ⇒ Object
20 21 22 |
# File 'lib/exlibris/primo/facet.rb', line 20 def name @name = xml.root["NAME"] end |
#size ⇒ Object Also known as: count
28 29 30 |
# File 'lib/exlibris/primo/facet.rb', line 28 def size @size = Integer(xml.root["COUNT"]) end |