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

Defined in:
build/mongoid-master/lib/mongoid/criteria/queryable/extensions/regexp.rb

Instance Method Summary collapse

Instance Method Details

#evolve(object) ⇒ BSON::Regexp::Raw

Evolve the object into a raw bson regex.

Examples:

Evolve the object to a regex.

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

Parameters:

  • object (BSON::Regexp::Raw, String)

    The object to evolve.

Returns:

  • (BSON::Regexp::Raw)

    The evolved raw regex.

Since:

  • 5.2.1



65
66
67
68
69
# File 'build/mongoid-master/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