Module: Mongoid::Extensions::String::ClassMethods

Defined in:
build/mongoid-master/lib/mongoid/extensions/string.rb

Instance Method Summary collapse

Instance Method Details

#demongoize(object) ⇒ String

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

Examples:

Demongoize the object.

String.demongoize(object)

Parameters:

  • object (Object)

    The object to demongoize.

Returns:

Since:

  • 3.0.0



187
188
189
# File 'build/mongoid-master/lib/mongoid/extensions/string.rb', line 187

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

#mongoize(object) ⇒ String

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

Examples:

Mongoize the object.

String.mongoize("123.11")

Parameters:

  • object (Object)

    The object to mongoize.

Returns:

  • (String)

    The object mongoized.

Since:

  • 3.0.0



202
203
204
# File 'build/mongoid-master/lib/mongoid/extensions/string.rb', line 202

def mongoize(object)
  demongoize(object)
end