Module: Mongoid::Matcher::EqImplWithRegexp Private

Defined in:
build/mongoid-7.3/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

Class Method Details

.matches?(original_operator, value, condition) ⇒ 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:



9
10
11
12
13
14
15
16
17
18
# File 'build/mongoid-7.3/lib/mongoid/matcher/eq_impl_with_regexp.rb', line 9

module_function def matches?(original_operator, value, condition)
  case condition
  when Regexp
    value =~ condition
  when ::BSON::Regexp::Raw
    value =~ condition.compile
  else
    value == condition
  end
end