Module: Mongoid::Extensions::Binary::ClassMethods
- Defined in:
- build/mongoid-8.1/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.
28 29 30 31 32 33 34 |
# File 'build/mongoid-8.1/lib/mongoid/extensions/binary.rb', line 28 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 |