Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/verso/hash.rb
Instance Method Summary collapse
Instance Method Details
#symbolize_nested_keys! ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/verso/hash.rb', line 2 def symbolize_nested_keys! keys.each do |key| self[(key.to_sym rescue key) || key] = if self[key].is_a?(Hash) delete(key).symbolize_nested_keys! elsif self[key].is_a?(Array) delete(key).collect do |i| if i.is_a?(Hash) i.symbolize_nested_keys! end i end else delete(key) end end self end |