Module: Mongoid::Extensions::Binary::ClassMethods
- Defined in:
- lib/mongoid/extensions/binary.rb
Instance Method Summary collapse
-
#mongoize(object) ⇒ BSON::Binary | nil
(also: #demongoize)
Mongoize an object of any type to how it’s stored in the db.
Instance Method Details
#mongoize(object) ⇒ BSON::Binary | nil Also known as: demongoize
Mongoize an object of any type to how it’s stored in the db.
31 32 33 34 35 36 37 |
# 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 |