Skip to content

Instantly share code, notes, and snippets.

@ZenCocoon
Created November 12, 2009 21:01
Show Gist options
  • Save ZenCocoon/233274 to your computer and use it in GitHub Desktop.
Save ZenCocoon/233274 to your computer and use it in GitHub Desktop.
# In Ruby
# How to deeply fetch an Hash
# Having :
hash = {"parent" => {"child" => "value"}}
# How to get value from "parent.child" ?
# Ideal solution
hash.deep_fetch(["parent", "child"])
=> "value"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment