Skip to content

Instantly share code, notes, and snippets.

@bertomartin
Forked from mgamba/gist:5120453
Created March 8, 2013 23:28
Show Gist options
  • Select an option

  • Save bertomartin/5120984 to your computer and use it in GitHub Desktop.

Select an option

Save bertomartin/5120984 to your computer and use it in GitHub Desktop.
def nested_keys(h)
th = {"keys" => h.keys.sort}
h.each{|k,v| th[k] = nested_keys(h[k]) if h[k].class == Hash }
th
end
nested_keys(h1).diff(nested_keys(h2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment