Module: Mongoid::Extensions::Hash::ClassMethods
- Defined in:
- lib/mongoid/extensions/hash.rb
Instance Method Summary collapse
-
#mongoize(object) ⇒ Hash | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
-
#resizable? ⇒ true
Can the size of this object change?.
Instance Method Details
#mongoize(object) ⇒ Hash | nil
Turn the object from the ruby type we deal with to a Mongo friendly type.
123 124 125 126 127 128 129 130 131 |
# File 'lib/mongoid/extensions/hash.rb', line 123 def mongoize(object) return if object.nil? case object when BSON::Document object.dup.transform_values!(&:mongoize) when Hash BSON::Document.new(object.transform_values(&:mongoize)) end end |
#resizable? ⇒ true
Can the size of this object change?
139 140 141 |
# File 'lib/mongoid/extensions/hash.rb', line 139 def resizable? true end |