123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Defined in: lib/mongoid/criteria/queryable/extensions/regexp.rb

Instance Method Summary

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.

[ GitHub ]

  
# 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