Class: Exlibris::Primo::Facet

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

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, #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

#accurateObject 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_nameObject



24
25
26
# File 'lib/exlibris/primo/facet.rb', line 24

def display_name
  @display_name ||= (config.facet_labels[name] || name)
end

#facet_valuesObject



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

#nameObject



20
21
22
# File 'lib/exlibris/primo/facet.rb', line 20

def name
  @name = xml.root["NAME"]
end

#sizeObject Also known as: count



28
29
30
# File 'lib/exlibris/primo/facet.rb', line 28

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