module Mongoid::Criteria::Queryable::Extensions::Regexp::Raw_::ClassMethods

Public Instance Methods

evolve(object) click to toggle source

Evolve the object into a raw bson regex.

@example Evolve the object to a regex.

BSON::Regexp::Raw.evolve("\\A[123]")

@param [ BSON::Regexp::Raw, String ] object The object to evolve.

@return [ BSON::Regexp::Raw ] The evolved raw regex.

@since 5.2.1

# File lib/mongoid/criteria/queryable/extensions/regexp.rb, line 65
def evolve(object)
  __evolve__(object) do |obj|
    obj.is_a?(String) ? BSON::Regexp::Raw.new(obj) : obj
  end
end