module Mongoid::Extensions::Regexp::ClassMethods

Public Instance Methods

mongoize(object) click to toggle source

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

@example Mongoize the object.

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

@param [ Regexp, String ] object The object to mongoize.

@return [ Regexp ] The object mongoized.

@since 3.0.0

# File lib/mongoid/extensions/regexp.rb, line 21
def mongoize(object)
  return nil if object.nil?
  ::Regexp.new(object)
end