Module: Mongoid::Matcher::EqImplWithRegexp Private
- Defined in:
- lib/mongoid/matcher/eq_impl_with_regexp.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This is an internal equality implementation that performs exact comparisons and regular expression matches.
Class Method Summary collapse
-
.matches?(original_operator, value, condition) ⇒ true | false, Boolean
private
Returns whether a value satisfies an $eq (or similar) expression, performing a regular expression match if the condition is a regular expression.
Class Method Details
.matches?(original_operator, value, condition) ⇒ true | false, Boolean
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.
Returns whether a value satisfies an $eq (or similar) expression, performing a regular expression match if the condition is a regular expression.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mongoid/matcher/eq_impl_with_regexp.rb', line 22 module_function def matches?(original_operator, value, condition) case condition when Regexp value =~ condition when ::BSON::Regexp::Raw value =~ condition.compile else if value.kind_of?(Time) && condition.kind_of?(Time) EqImpl.time_eq?(value, condition) else value == condition end end end |