Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/simple-templater.rb,
lib/simple-templater/core_exts.rb
Instance Method Summary collapse
- #reverse_merge!(hash) ⇒ Object
-
#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
#reverse_merge!(hash) ⇒ Object
5 6 7 |
# File 'lib/simple-templater.rb', line 5 def reverse_merge!(hash) self.replace(hash.merge(self)) end |
#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 |