module Mongoid::Matcher::FieldOperator
@api private
Constants
- MAP
Public Instance Methods
apply_array_field_operator(exists, value, condition) { |v| ... }
click to toggle source
# File lib/mongoid/matcher/field_operator.rb, line 35 def apply_array_field_operator(exists, value, condition) if Array === value value.any? { |v| yield v } else yield value end end
apply_comparison_operator(operator, left, right)
click to toggle source
# File lib/mongoid/matcher/field_operator.rb, line 43 def apply_comparison_operator(operator, left, right) left.send(operator, right) rescue ArgumentError, NoMethodError, TypeError # We silence bogus comparison attempts, e.g. number to string # comparisons. # Several different exceptions may be produced depending on the types # involved. false end
get(op)
click to toggle source
# File lib/mongoid/matcher/field_operator.rb, line 29 def get(op) MAP.fetch(op) rescue KeyError raise Errors::InvalidFieldOperator.new(op) end