Module: SemiStatic::CoreExt::Hash
- Included in:
- Hash
- Defined in:
- lib/semi-static/core_ext/hash.rb
Instance Method Summary collapse
-
#symbolize_keys ⇒ Object
Replace self with a hash whose keys have been converted to symbols.
Instance Method Details
#symbolize_keys ⇒ Object
Replace self with a hash whose keys have been converted to symbols.
5 6 7 8 9 10 11 12 |
# File 'lib/semi-static/core_ext/hash.rb', line 5 def symbolize_keys hash = to_a.inject({}) do |memo,item| key, value = item memo[key.to_sym] = value memo end replace(hash) end |