Class: Exlibris::Primo::FacetValue
- Inherits:
-
Object
- Object
- Exlibris::Primo::FacetValue
- Includes:
- Config::Attributes, WriteAttributes, XmlUtil
- Defined in:
- lib/exlibris/primo/facet_value.rb
Overview
Primo facet value that holds the name of the value and the number of records that limiting by this facet value would return.
Instance Attribute Summary collapse
-
#facet ⇒ Object
Returns the value of attribute facet.
Instance Method Summary collapse
- #display_name ⇒ Object
-
#initialize(*args) ⇒ FacetValue
constructor
A new instance of FacetValue.
- #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) ⇒ FacetValue
Returns a new instance of FacetValue.
16 17 18 19 |
# File 'lib/exlibris/primo/facet_value.rb', line 16 def initialize *args @raw_xml = args.last.delete(:raw_xml) super end |
Instance Attribute Details
#facet ⇒ Object
Returns the value of attribute facet.
14 15 16 |
# File 'lib/exlibris/primo/facet_value.rb', line 14 def facet @facet end |
Instance Method Details
#display_name ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/exlibris/primo/facet_value.rb', line 25 def display_name return @display_name ||= (ISO_639.find(name).english_name || name) if facet.name.eql? "lang" return @display_name ||= (config.libraries[name] || name) if facet.name.eql? "library" return @display_name ||= (config.facet_top_level[name] || name) if facet.name.eql? "tlevel" return @display_name ||= (config.facet_collections[name] || name) if facet.name.eql? "domain" return @display_name ||= (config.facet_resource_types[name] || name) if facet.name.eql? "rtype" @display_name ||= name end |
#name ⇒ Object
21 22 23 |
# File 'lib/exlibris/primo/facet_value.rb', line 21 def name @name ||= xml.root["KEY"] end |
#size ⇒ Object Also known as: count
34 35 36 |
# File 'lib/exlibris/primo/facet_value.rb', line 34 def size @size = Integer(xml.root["VALUE"]) end |