Class: Hash
- Defined in:
- lib/partigirb/core_ext.rb,
lib/partigirb/core_ext.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#stringify_keys ⇒ Object
Return a new hash with all keys converted to strings.
-
#stringify_keys! ⇒ Object
Destructively convert all keys to strings.
Instance Method Details
#stringify_keys ⇒ Object
Return a new hash with all keys converted to strings.
5 6 7 8 9 10 |
# File 'lib/partigirb/core_ext.rb', line 5 def stringify_keys inject({}) do |, (key, value)| [key.to_s] = value end end |
#stringify_keys! ⇒ Object
Destructively convert all keys to strings.
13 14 15 16 17 18 |
# File 'lib/partigirb/core_ext.rb', line 13 def stringify_keys! keys.each do |key| self[key.to_s] = delete(key) end self end |