Class: DNZ::Facet

Inherits:
Object
  • Object
show all
Defined in:
lib/dnz/facet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, search, doc) ⇒ Facet

Returns a new instance of Facet.



20
21
22
23
24
25
26
27
28
29
# File 'lib/dnz/facet.rb', line 20

def initialize(client, search, doc)
  @name = doc.xpath('facet-field').text
  @values = []
  @search = search

  doc.xpath('values').first.children.each do |value_doc|
    value = DNZ::FacetValue.new(client, self, value_doc)
    @values << value if value.valid?
  end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/dnz/facet.rb', line 16

def name
  @name
end

#searchObject (readonly)

Returns the value of attribute search.



18
19
20
# File 'lib/dnz/facet.rb', line 18

def search
  @search
end

#valuesObject (readonly)

Returns the value of attribute values.



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

def values
  @values
end