Module: Mongoid::Extensions::Regexp::ClassMethods

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

Instance Method Summary collapse

Instance Method Details

#mongoize(object) ⇒ Regexp

Turn the object from the ruby type we deal with to a Mongo friendly type.

Examples:

Mongoize the object.

Regexp.mongoize(/\A[abc]/)

Parameters:

Returns:

  • (Regexp)

    The object mongoized.

Since:

  • 3.0.0



21
22
23
24
# File 'build/mongoid-master/lib/mongoid/extensions/regexp.rb', line 21

def mongoize(object)
  return nil if object.nil?
  ::Regexp.new(object)
end