Skip to content

Instantly share code, notes, and snippets.

@rhaamo
Created June 9, 2010 21:14
Show Gist options
  • Save rhaamo/432181 to your computer and use it in GitHub Desktop.
Save rhaamo/432181 to your computer and use it in GitHub Desktop.
=> {"title"=>"foo", "children"=>{"title"=>"bar", "children"=>{"pony"=>"pink", "title"=>"baz"}}}
ree-1.8.7-2010.01 > a=[{"title" => "foo", "children" => [{"title" => "bar", "children" => [{"title" => "baz", "pony" => "pink"}]}]}]
ree-1.8.7-2010.01 > z
=> "foo.bar.baz"
ree-1.8.7-2010.01 > a.find {|s| s["title"] == "foo"}["children"].find {|s| s["title"] == "bar"}["children"].find {|s| s["title"] == "baz"}
=> {"pony"=>"pink", "title"=>"baz"}
Avoir pareil depuis 'z'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment