Class: Sift::WhereHandler

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

Constant Summary collapse

NULL_TOKEN =
"null"

Instance Method Summary collapse

Constructor Details

#initialize(param) ⇒ WhereHandler

Returns a new instance of WhereHandler.



5
6
7
# File 'lib/sift/where_handler.rb', line 5

def initialize(param)
  @param = param
end

Instance Method Details

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



9
10
11
12
13
14
15
16
17
# File 'lib/sift/where_handler.rb', line 9

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