Sha256: 43755ef33e506780bb09f03322002882045536788cc6dc824f4f5693c16c7ce4
Contents?: true
Size: 693 Bytes
Versions: 3
Compression:
Stored size: 693 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-5.4.1 | lib/mongoid/matchable/regexp.rb |
mongoid-5.4.0 | lib/mongoid/matchable/regexp.rb |
mongoid-5.2.1 | lib/mongoid/matchable/regexp.rb |