Skip to content

Instantly share code, notes, and snippets.

@szajbus
Created January 12, 2014 20:49
Show Gist options
  • Save szajbus/8390437 to your computer and use it in GitHub Desktop.
Save szajbus/8390437 to your computer and use it in GitHub Desktop.
require 'hashie_walker' # https://github.com/monterail/hashie_walker
require 'active_support/inflector'
hash = {
"CamelCased" => {
"AnotherOne" => {
"Foo" => "Bar",
"FooFooFoo" => "Dupa"
}
}
}
HashieWalker.walk(hash) do |map|
map.key { |key| key.underscore }
end
#=> {"camel_cased"=>{"another_one"=>{"foo"=>"Bar", "foo_foo_foo"=>"Dupa"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment