class Toller::Filters::WhereHandler
Where handler for filter
Public Instance Methods
call(collection, type, value, properties)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 9 def call(collection, type, value, properties) field_name = properties[:field] mutated_value = value_mutator(type, value) collection.where(field_name => mutated_value) end
Private Instance Methods
boolean_mutator(value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 25 def boolean_mutator(value) Mutators::Boolean.call(value) end
date_mutator(value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 33 def date_mutator(value) Mutators::Date.call(value) end
datetime_mutator(value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 41 def datetime_mutator(value) Mutators::Datetime.call(value) end
integer_mutator(value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 29 def integer_mutator(value) Mutators::Integer.call(value) end
time_mutator(value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 37 def time_mutator(value) Mutators::Time.call(value) end
value_mutator(type, value)
click to toggle source
# File lib/toller/filters/where_handler.rb, line 19 def value_mutator(type, value) return value unless %i[boolean date datetime integer time].include?(type) send("#{type}_mutator", value) end