Deep Hash transformation using Lambdas

Today I had the need in my job of implementing a similar behaviour of what Rails hash method .deep_symbolize_keys does. Here is a possible implementation of a deep recursive hash transformation, using recursive lambdas.

deep_symbolize_keys = lambda do |hash|  
  return hash unless hash.is_a?(Hash)

  Hash[ do |key, value|
    # if value is array, loop each element and recursively symbolize keys
    if value.is_a? Array
      value = { |element| }
    # if value is hash, recursively symbolize keys
    elsif value.is_a? Hash
      value =

    [key.to_sym, value]
  end ]