Class: Xapit::Client::FacetOption
- Inherits:
-
Object
- Object
- Xapit::Client::FacetOption
- Defined in:
- lib/xapit/client/facet_option.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(attribute, option, applied_facets = []) ⇒ FacetOption
constructor
A new instance of FacetOption.
- #name ⇒ Object
- #to_param ⇒ Object
Constructor Details
#initialize(attribute, option, applied_facets = []) ⇒ FacetOption
Returns a new instance of FacetOption.
5 6 7 8 9 10 |
# File 'lib/xapit/client/facet_option.rb', line 5 def initialize(attribute, option, applied_facets = []) @attribute = attribute @value = option[:value] @count = option[:count].to_i @applied_facets = applied_facets end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
4 5 6 |
# File 'lib/xapit/client/facet_option.rb', line 4 def attribute @attribute end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
4 5 6 |
# File 'lib/xapit/client/facet_option.rb', line 4 def count @count end |
Instance Method Details
#identifier ⇒ Object
12 13 14 |
# File 'lib/xapit/client/facet_option.rb', line 12 def identifier Xapit.facet_identifier(@attribute, @value) end |
#name ⇒ Object
16 17 18 |
# File 'lib/xapit/client/facet_option.rb', line 16 def name @value end |
#to_param ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/xapit/client/facet_option.rb', line 20 def to_param if @applied_facets.include? identifier (@applied_facets - [identifier]).join('-') else (@applied_facets + [identifier]).join("-") end end |