Module: Mongoid::Extensions::Hash::ClassMethods
- Defined in:
- build/mongoid-8.1/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.
225 226 227 228 229 230 231 232 233 |
# File 'build/mongoid-8.1/lib/mongoid/extensions/hash.rb', line 225 def mongoize(object) return if object.nil? if object.is_a?(Hash) # Need to use transform_values! which maintains the BSON::Document # instead of transform_values which always returns a hash. To do this, # we first need to dup the hash. object.dup.transform_values!(&:mongoize) end end |
#resizable? ⇒ true
Can the size of this object change?
241 242 243 |
# File 'build/mongoid-8.1/lib/mongoid/extensions/hash.rb', line 241 def resizable? true end |