module Mongoid::Extensions::Binary::ClassMethods
Public Instance Methods
mongoize(object)
click to toggle source
Mongoize an object of any type to how it’s stored in the db.
@example Mongoize the object.
BigDecimal.mongoize(123)
@param [ Object
] object The object to Mongoize
@return [ BSON::Binary | nil ] A Binary
representing the object or nil.
# File lib/mongoid/extensions/binary.rb, line 31 def mongoize(object) return if object.nil? case object when BSON::Binary then object when String, Symbol then BSON::Binary.new(object.to_s) end end
Also aliased as: demongoize