Class: ThinkingSphinx::FacetSearch::Filter
- Inherits:
-
Object
- Object
- ThinkingSphinx::FacetSearch::Filter
- Defined in:
- lib/thinking_sphinx/facet_search.rb
Instance Method Summary collapse
-
#initialize(facets, hash) ⇒ Filter
constructor
A new instance of Filter.
- #to_hash ⇒ Object
Constructor Details
#initialize(facets, hash) ⇒ Filter
Returns a new instance of Filter.
128 129 130 |
# File 'lib/thinking_sphinx/facet_search.rb', line 128 def initialize(facets, hash) @facets, @hash = facets, hash end |
Instance Method Details
#to_hash ⇒ Object
132 133 134 135 136 137 138 139 |
# File 'lib/thinking_sphinx/facet_search.rb', line 132 def to_hash @hash.keys.inject({}) { |, key| type = @facets.detect { |facet| facet.name == key.to_s }.filter_type [type] ||= {} [type][key] = @hash[key] } end |