Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/muddyit_fu.rb
Instance Method Summary collapse
- #nested_stringify_keys! ⇒ Object
-
#nested_symbolize_keys! ⇒ Object
File merb/core_ext/hash.rb, line 166.
Instance Method Details
#nested_stringify_keys! ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/muddyit_fu.rb', line 64 def nested_stringify_keys! each do |k,v| s = k.respond_to?(:to_s) ? k.to_s : k self[s] = Hash === v ? v.nested_stringify_keys! : v delete(k) unless k == s end self end |
#nested_symbolize_keys! ⇒ Object
File merb/core_ext/hash.rb, line 166
55 56 57 58 59 60 61 62 |
# File 'lib/muddyit_fu.rb', line 55 def nested_symbolize_keys! each do |k,v| sym = k.respond_to?(:to_sym) ? k.to_sym : k self[sym] = Hash === v ? v.nested_symbolize_keys! : v delete(k) unless k == sym end self end |