let's say i have a multidimensional hash, and in one of the subhashes i have a key=>value pair which i need to retrieve by key. how can i do it?
example hashes:
h={:x=>1,:y=>2,:z=>{:a=>{:k=>"needle"}}}
h={:k=>"needle"}
key is always :k, and i need to get "needle"
i noticed that there is no "flatten" function for hashes in ruby 1.8, but if it'd be there, i imagine i'd just do
h.flatten[:k]
i imagine i need to write a recursive function for that?
thanks