module Mongoid::Extensions::Float::ClassMethods

Public Instance Methods

demongoize(object)
Alias for: mongoize
mongoize(object) click to toggle source

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

@example Mongoize the object.

Float.mongoize("123.11")

@param [ Object ] object The object to mongoize.

@return [ String ] The object mongoized.

@since 3.0.0

# File lib/mongoid/extensions/float.rb, line 45
def mongoize(object)
  unless object.blank?
    __numeric__(object).to_f rescue 0.0
  else
    nil
  end
end
Also aliased as: demongoize