Class: Mongoid::StringifiedSymbol

Inherits:
Object
  • Object
show all
Defined in:
build/mongoid-master/lib/mongoid/stringified_symbol.rb

Class Method Summary collapse

Class Method Details

.demongoize(object) ⇒ Symbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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:

  • (Symbol)

    The object.



20
21
22
23
24
25
26
# File 'build/mongoid-master/lib/mongoid/stringified_symbol.rb', line 20

def demongoize(object)
  if object.nil?
    object
  else
    object.to_s.to_sym
  end
end

.evolve(object) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
# File 'build/mongoid-master/lib/mongoid/stringified_symbol.rb', line 48

def evolve(object)
  mongoize(object)
end

.mongoize(object) ⇒ Symbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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.



39
40
41
42
43
44
45
# File 'build/mongoid-master/lib/mongoid/stringified_symbol.rb', line 39

def mongoize(object)
   if object.nil?
     object
   else
     object.to_s
   end
end