Skip to content

Instantly share code, notes, and snippets.

@seki seki/digdig.rb
Created Mar 15, 2018

Embed
What would you like to do?
class Array
def keys
0...size
end
end
def find(it, key, &blk)
it.keys.each do |k|
v = it[k]
k == key ? yield(v) : find(v, key, &blk)
end
rescue
# nop
end
e = ENV.to_hash
e['more'] = ENV.to_hash
e['x'] = [1,2,3, ENV.to_hash]
find(e, 'SHELL') {|x| p x}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.