Class: Tire::Search::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/tire/search/filter.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(type, *options) ⇒ Filter

Returns a new instance of Filter.



9
10
11
12
13
14
15
16
# File 'lib/tire/search/filter.rb', line 9

def initialize(type, *options)
  value = if options.size < 2
    options.first || {}
  else
    options # An +or+ filter encodes multiple filters as an array
  end
  @hash = { type => value }
end

Instance Method Details

#to_hashObject



22
23
24
# File 'lib/tire/search/filter.rb', line 22

def to_hash
  @hash
end

#to_json(options = {}) ⇒ Object



18
19
20
# File 'lib/tire/search/filter.rb', line 18

def to_json(options={})
  to_hash.to_json
end