Sha256: 9b51e2208f2e0e52cfe25cb25581dd35c2e68de793426d46452a3c7cfaab861e

Contents?: true

Size: 696 Bytes

Versions: 22

Compression:

Stored size: 696 Bytes

Contents

module Mongoid
  module Matchable

    # Defines behavior for handling regular expressions in embedded documents.
    class Regexp < Default

      # Does the supplied query match the attribute?
      #
      # @example Does this match?
      #   matcher._matches?(/^Em/)
      #   matcher._matches?(BSON::Regex::Raw.new("^Em"))
      #
      # @param [ BSON::Regexp::Raw, Regexp ] regexp The regular expression object.
      #
      # @return [ true, false ] True if matches, false if not.
      #
      # @since 5.2.1
      def _matches?(regexp)
        if native_regexp = regexp.try(:compile)
          super(native_regexp)
        else
          super
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
mongoid-6.4.8 lib/mongoid/matchable/regexp.rb
mongoid-6.4.7 lib/mongoid/matchable/regexp.rb
mongoid-6.4.5 lib/mongoid/matchable/regexp.rb
mongoid-7.0.7 lib/mongoid/matchable/regexp.rb
mongoid-7.0.6 lib/mongoid/matchable/regexp.rb
mongoid-7.0.5 lib/mongoid/matchable/regexp.rb
mongoid-7.0.4 lib/mongoid/matchable/regexp.rb
mongoid-6.4.4 lib/mongoid/matchable/regexp.rb
mongoid-7.0.3 lib/mongoid/matchable/regexp.rb
mongoid-6.4.2 lib/mongoid/matchable/regexp.rb
mongoid-7.0.2 lib/mongoid/matchable/regexp.rb
mongoid-7.0.1 lib/mongoid/matchable/regexp.rb
mongoid-6.4.1 lib/mongoid/matchable/regexp.rb
tdiary-5.0.8 vendor/bundle/gems/mongoid-6.4.0/lib/mongoid/matchable/regexp.rb
mongoid-7.0.0 lib/mongoid/matchable/regexp.rb
mongoid-6.4.0 lib/mongoid/matchable/regexp.rb
mongoid-6.3.0 lib/mongoid/matchable/regexp.rb
mongoid-6.2.1 lib/mongoid/matchable/regexp.rb
mongoid-7.0.0.beta lib/mongoid/matchable/regexp.rb
tdiary-5.0.5 vendor/bundle/gems/mongoid-6.2.0/lib/mongoid/matchable/regexp.rb