Class: Median::Primo::Facet

Inherits:
Object
  • Object
show all
Includes:
XmlSupport
Defined in:
lib/median/primo/facet.rb

Defined Under Namespace

Classes: FacetValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Facet

Returns a new instance of Facet.



6
7
8
9
10
11
12
13
14
15
# File 'lib/median/primo/facet.rb', line 6

def initialize(xml)
  super(xml)
  @values = xml.xpath(".//FACET_VALUES").collect{ |xml| FacetValue.new(xml) }

  if name == 'creationdate'
    @values.sort!{ |x, y| y.key <=> x.key }
  else
    @values.sort!{ |x, y| y.count <=> x.count }
  end
end

Instance Attribute Details

#valuesObject (readonly)

Returns the value of attribute values.



17
18
19
# File 'lib/median/primo/facet.rb', line 17

def values
  @values
end