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

Defined in:
build/mongoid-7.3/lib/mongoid/extensions/symbol.rb

Instance Method Summary collapse

Instance Method Details

#demongoize(object) ⇒ Symbol

Convert the object from its mongo friendly ruby type to this type.

Examples:

Demongoize the object.

Symbol.demongoize(object)

Parameters:

  • object (Object)

    The object to demongoize.

Returns:

Since:

  • 3.0.0



32
33
34
# File 'build/mongoid-7.3/lib/mongoid/extensions/symbol.rb', line 32

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

#mongoize(object) ⇒ Symbol

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)

    The object mongoized.

Since:

  • 3.0.0



47
48
49
# File 'build/mongoid-7.3/lib/mongoid/extensions/symbol.rb', line 47

def mongoize(object)
  demongoize(object)
end