Class: Sift::WhereHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/sift/where_handler.rb

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ WhereHandler

Returns a new instance of WhereHandler.



3
4
5
# File 'lib/sift/where_handler.rb', line 3

def initialize(param)
  @param = param
end

Instance Method Details

#call(collection, value, _params, _scope_params) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/sift/where_handler.rb', line 7

def call(collection, value, _params, _scope_params)
  if @param.type == :jsonb
    apply_jsonb_conditions(collection, value)
  else
    collection.where(@param.internal_name => value)
  end
end