Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/bravo/core_ext/hash.rb
Instance Method Summary collapse
- #symbolize_keys ⇒ Object
- #symbolize_keys! ⇒ Object
- #underscore_keys ⇒ Object
- #underscore_keys! ⇒ Object
Instance Method Details
#symbolize_keys ⇒ Object
9 10 11 |
# File 'lib/bravo/core_ext/hash.rb', line 9 def symbolize_keys dup.symbolize_keys! end |
#symbolize_keys! ⇒ Object
2 3 4 5 6 7 |
# File 'lib/bravo/core_ext/hash.rb', line 2 def symbolize_keys! keys.each do |key| self[(key.to_sym rescue key) || key] = delete(key) end self end |
#underscore_keys ⇒ Object
20 21 22 |
# File 'lib/bravo/core_ext/hash.rb', line 20 def underscore_keys dup.underscore_keys! end |
#underscore_keys! ⇒ Object
13 14 15 16 17 18 |
# File 'lib/bravo/core_ext/hash.rb', line 13 def underscore_keys! keys.each do |key| self[(key.underscore rescue key) || key] = delete(key) end self end |