Skip to content

Instantly share code, notes, and snippets.

@hayduke19us
Last active December 15, 2016 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayduke19us/2a2e21c5caf9e669f5a7359cbead5d82 to your computer and use it in GitHub Desktop.
Save hayduke19us/2a2e21c5caf9e669f5a7359cbead5d82 to your computer and use it in GitHub Desktop.
def dig(data, *keys)
while keys.any?
outer_data = data[keys.shift]
inner_data = outer_data
break unless inner_data
end
inner_data
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment