Skip to content

Instantly share code, notes, and snippets.

@budu
Last active January 4, 2016 07:19
Show Gist options
  • Select an option

  • Save budu/8587861 to your computer and use it in GitHub Desktop.

Select an option

Save budu/8587861 to your computer and use it in GitHub Desktop.
Hash.class_eval do
def recursive_map_values(&block)
reduce({}) do |m, (k, v)|
m[k] = v.is_a?(Hash) ? v.recursive_map_values(&block) : block.call(self, k, v)
m
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment