Module: Hashie::Extensions::StringifyKeys
- Included in:
- Hash
- Defined in:
- lib/hashie/extensions/stringify_keys.rb
Instance Method Summary collapse
-
#stringify_keys ⇒ Object
Return a new hash with all keys converted to strings.
-
#stringify_keys! ⇒ Object
Convert all keys in the hash to strings.
Instance Method Details
#stringify_keys ⇒ Object
Return a new hash with all keys converted to strings.
20 21 22 |
# File 'lib/hashie/extensions/stringify_keys.rb', line 20 def stringify_keys dup.stringify_keys! end |
#stringify_keys! ⇒ Object
Convert all keys in the hash to strings.
10 11 12 13 14 15 16 |
# File 'lib/hashie/extensions/stringify_keys.rb', line 10 def stringify_keys! keys.each do |k| stringify_keys_recursively!(self[k]) self[k.to_s] = delete(k) end self end |