Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/initializers/hash.rb

Instance Method Summary collapse

Instance Method Details

#deep_transform_keys(&block) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/initializers/hash.rb', line 2

def deep_transform_keys(&block)
  result = {}
  each do |key, value|
    result[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys(&block) : value
  end
  result
end