Class: Slingshot::Search::Filter
- Inherits:
-
Object
- Object
- Slingshot::Search::Filter
- Defined in:
- lib/slingshot/search/filter.rb
Overview
Instance Method Summary collapse
-
#initialize(type, *options) ⇒ Filter
constructor
A new instance of Filter.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(type, *options) ⇒ Filter
Returns a new instance of Filter.
9 10 11 12 13 14 15 16 |
# File 'lib/slingshot/search/filter.rb', line 9 def initialize(type, *) value = if .size < 2 .first || {} else # An +or+ filter encodes multiple filters as an array end @hash = { type => value } end |
Instance Method Details
#to_hash ⇒ Object
22 23 24 |
# File 'lib/slingshot/search/filter.rb', line 22 def to_hash @hash end |
#to_json ⇒ Object
18 19 20 |
# File 'lib/slingshot/search/filter.rb', line 18 def to_json to_hash.to_json end |