Skip to content

Instantly share code, notes, and snippets.

@tadman
Created March 30, 2009 21:04
Show Gist options
  • Save tadman/87887 to your computer and use it in GitHub Desktop.
Save tadman/87887 to your computer and use it in GitHub Desktop.
class Hash
def dig(*path)
path.inject(self) do |location, key|
location.respond_to?(:keys) ? location[key] : nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment