Class: Xapit::Client::Facet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute, options, applied_facets = []) ⇒ Facet

Returns a new instance of Facet.



5
6
7
8
# File 'lib/xapit/client/facet.rb', line 5

def initialize(attribute, options, applied_facets = [])
  @name = attribute.to_s.gsub("_", " ").gsub(/\b([a-z])/) { $1.to_s.upcase }
  @options = options.map { |option| FacetOption.new(attribute, option, applied_facets) }
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/xapit/client/facet.rb', line 4

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/xapit/client/facet.rb', line 4

def options
  @options
end