Class: Mongoid::StringifiedSymbol

Inherits:
Object
  • Object
show all
Defined in:
lib/rocket_job/extensions/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.



17
18
19
20
21
22
23
# File 'lib/rocket_job/extensions/mongoid/stringified_symbol.rb', line 17

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.



45
46
47
# File 'lib/rocket_job/extensions/mongoid/stringified_symbol.rb', line 45

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.



36
37
38
39
40
41
42
# File 'lib/rocket_job/extensions/mongoid/stringified_symbol.rb', line 36

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