Assuming some hashes in the array only have path a.b or {"a"=>{"b"=>"someanswer"}}, how do I make the below code robust enough to display the last element without dieing?
path = ("a.b.c.d")
arrayOfHashes.collect {|hash| path.split(".").inject(hash) { |hash, key| hash[key] }}
The specifications are not complete. Something like that?