123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Extended In:
Defined in: lib/mongoid/extensions/symbol.rb

Instance Method Summary

Instance Method Details

#demongoize(object)

Alias for #mongoize.

[ GitHub ]

  
# File 'lib/mongoid/extensions/symbol.rb', line 36

alias :demongoize :mongoize

#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.

[ GitHub ]

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

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