Skip to content

Instantly share code, notes, and snippets.

@seanrclayton
Created April 16, 2014 21:43
Show Gist options
  • Save seanrclayton/10936193 to your computer and use it in GitHub Desktop.
Save seanrclayton/10936193 to your computer and use it in GitHub Desktop.
loop through hash
def iterate_hash(hash, i_want)
@i_want = i_want
hash.each_pair do |k,v|
if k == i_want
puts "#{k} is the fucking key"
puts "#{v} is the fucking value"
end
if v.is_a?(Hash)
iterate_hash(v, @i_want)
end
end
end
@nickwales
Copy link

I bet i know which bit is not Andrews

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment