Module: Mongoid::Extensions::Hash
- Defined in:
- lib/mongoid/extensions/hash.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary (collapse)
-
- (Hash) __evolve_object_id__
Evolves each value in the hash to an object id if it is convertable.
-
- (Object) extract_id
Get the id attribute from this hash, whether it's prefixed with an underscore or is a symbol.
-
- (Hash) mongoize
Turn the object from the ruby type we deal with to a Mongo friendly type.
-
- (true) resizable?
Can the size of this object change?.
Instance Method Details
- (Hash) __evolve_object_id__
Evolves each value in the hash to an object id if it is convertable.
14 15 16 |
# File 'lib/mongoid/extensions/hash.rb', line 14 def __evolve_object_id__ update_values(&:__evolve_object_id__) end |
- (Object) extract_id
Get the id attribute from this hash, whether it's prefixed with an underscore or is a symbol.
27 28 29 |
# File 'lib/mongoid/extensions/hash.rb', line 27 def extract_id self["id"] || self["_id"] || self[:id] || self[:_id] end |
- (Hash) mongoize
Turn the object from the ruby type we deal with to a Mongo friendly type.
40 41 42 |
# File 'lib/mongoid/extensions/hash.rb', line 40 def mongoize ::Hash.mongoize(self) end |
- (true) resizable?
Can the size of this object change?
52 53 54 |
# File 'lib/mongoid/extensions/hash.rb', line 52 def resizable? true end |