Module: Shaven::CoreExt::Hash
- Included in:
- Hash
- Defined in:
- lib/shaven/core_ext/hash.rb
Overview
Contains helpers for keys stringifying. Implementation borrowed from activesupport.
Instance Method Summary collapse
Instance Method Details
#stringify_keys ⇒ Object
5 6 7 8 9 10 |
# File 'lib/shaven/core_ext/hash.rb', line 5 def stringify_keys inject({}) { |, (key, value)| [key.to_s] = value } end |
#stringify_keys! ⇒ Object
12 13 14 15 |
# File 'lib/shaven/core_ext/hash.rb', line 12 def stringify_keys! keys.each { |key| self[key.to_s] = delete(key) } self end |