Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/simple-templater/core_exts.rb
Instance Method Summary collapse
-
#symbolize_keys ⇒ Hash
Return duplication of self with all keys non-recursively converted to symbols.
-
#symbolize_keys! ⇒ Hash
Replace keys in self by coresponding symbols.
Instance Method Details
#symbolize_keys ⇒ Hash
Return duplication of self with all keys non-recursively converted to symbols
84 85 86 87 88 89 |
# File 'lib/simple-templater/core_exts.rb', line 84 def symbolize_keys self.inject(Hash.new) do |result, array| result[array.first.to_sym] = array.last result end end |
#symbolize_keys! ⇒ Hash
Replace keys in self by coresponding symbols
96 97 98 |
# File 'lib/simple-templater/core_exts.rb', line 96 def symbolize_keys! self.replace(self.symbolize_keys) end |