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

Defined in:
build/mongoid-7.4/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.



18
19
20
21
# File 'build/mongoid-7.4/lib/mongoid/extensions/regexp.rb', line 18

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