Class: Exlibris::Primo::FacetValue

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Methods included from XmlUtil

included, #to_hash, #to_json, #to_xml

Methods included from WriteAttributes

#write_attributes

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

#facetObject

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_nameObject



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

#nameObject



21
22
23
# File 'lib/exlibris/primo/facet_value.rb', line 21

def name
  @name ||= xml.root["KEY"]
end

#sizeObject Also known as: count



34
35
36
# File 'lib/exlibris/primo/facet_value.rb', line 34

def size
  @size = Integer(xml.root["VALUE"])
end