Sha256: 1672cf8ee51d316995030b3968199709d758e5fa63b12a7a7325cb2d582fdd1c

Contents?: true

Size: 683 Bytes

Versions: 29

Compression:

Stored size: 683 Bytes

Contents

module Mongoid
  module Matcher

    # This is an internal equality implementation that performs exact
    # comparisons and regular expression matches.
    #
    # @api private
    module EqImplWithRegexp
      module_function def matches?(original_operator, value, condition)
        case condition
        when Regexp
          value =~ condition
        when ::BSON::Regexp::Raw
          value =~ condition.compile
        else
          if Mongoid.compare_time_by_ms &&
            value.kind_of?(Time) && condition.kind_of?(Time)
            EqImpl.time_eq?(value, condition)
          else
            value == condition
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
mongoid-8.0.3 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.5.2 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-8.0.2 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.5.1 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.4.3 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-8.0.1 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.5.0 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.4.1 lib/mongoid/matcher/eq_impl_with_regexp.rb
mongoid-7.4.0 lib/mongoid/matcher/eq_impl_with_regexp.rb