Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/annotatable.rb
Overview
We don’t necessarily have ActiveSupport loaded yet!
Instance Method Summary collapse
-
#symbolize_keys ⇒ Object
Return a new hash with all keys converted to symbols.
-
#symbolize_keys! ⇒ Object
Destructively convert all keys to symbols.
Instance Method Details
#symbolize_keys ⇒ Object
Return a new hash with all keys converted to symbols.
57 58 59 60 61 62 |
# File 'lib/annotatable.rb', line 57 def symbolize_keys inject({}) do |, (key, value)| [key.to_sym || key] = value end end |
#symbolize_keys! ⇒ Object
Destructively convert all keys to symbols.
65 66 67 |
# File 'lib/annotatable.rb', line 65 def symbolize_keys! self.replace(self.symbolize_keys) end |