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

Defined in:
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.



62
63
64
65
66
# File 'lib/mongoid/criteria/queryable/extensions/regexp.rb', line 62

def evolve(object)
  __evolve__(object) do |obj|
    obj.is_a?(String) ? BSON::Regexp::Raw.new(obj) : obj
  end
end