Module: Mongoid::Extensions::Symbol::ClassMethods

Defined in:
lib/mongoid/extensions/symbol.rb

Instance Method Summary collapse

Instance Method Details

#mongoize(object) ⇒ Symbol | nil Also known as: demongoize

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

Examples:

Mongoize the object.

Symbol.mongoize("123.11")

Parameters:

  • object (Object)

    The object to mongoize.

Returns:

  • (Symbol | nil)

    The object mongoized or nil.



33
34
35
# File 'lib/mongoid/extensions/symbol.rb', line 33

def mongoize(object)
  object.try(:to_sym)
end