Method: Mongoid::Matcher::FieldOperator.apply_comparison_operator

Defined in:
lib/mongoid/matcher/field_operator.rb

.apply_comparison_operator(operator, left, right) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

TODO:

Refactor this as it is only relevant to $lt, $lte, $gt, $gte.

Used for evaluating $lt, $lte, $gt, $gte comparison operators.



67
68
69
70
71
72
73
74
75
# File 'lib/mongoid/matcher/field_operator.rb', line 67

module_function 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