module CoreExt::Hash

Public Instance Methods

transform_keys() { |key| ... } click to toggle source

Returns a new hash with each key replaced with the return value of the specified block.

   # File lib/core_ext/hash.rb
 6 def transform_keys
 7   reduce({}) do |hash, (key, value)|
 8     key = yield(key)
 9     hash.update(key => value)
10   end
11 end