Module: Mongoo::HashExt
- Included in:
- Hash
- Defined in:
- lib/mongoo/hash_ext.rb
Instance Method Summary collapse
Instance Method Details
#deep_stringify_keys ⇒ Object
3 4 5 |
# File 'lib/mongoo/hash_ext.rb', line 3 def deep_stringify_keys Marshal.load(Marshal.dump(self)).deep_stringify_keys! end |
#deep_stringify_keys! ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/mongoo/hash_ext.rb', line 7 def deep_stringify_keys! keys.each do |key| self[key.to_s] = delete(key) if self[key.to_s].is_a?(Hash) self[key.to_s].stringify_keys! end end self end |