Skip to content

Instantly share code, notes, and snippets.

@Papierkorb
Created October 6, 2017 21:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Papierkorb/697e3c519ae70fbf16e1e6fd531fb6c5 to your computer and use it in GitHub Desktop.
Save Papierkorb/697e3c519ae70fbf16e1e6fd531fb6c5 to your computer and use it in GitHub Desktop.
module HashMiner
def self.dig(container, key, *remainder)
value = container[key]
dig(value, *remainder)
end
def self.dig(container, key)
container[key]
end
end
h = { "foo" => { "bar" => [ { "baz" => "Okay!" } ] } }
pp HashMiner.dig(h, "foo", "bar", 0, "baz")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment