Skip to content

Instantly share code, notes, and snippets.

@johnnygoodman
Created August 25, 2010 02:55
Show Gist options
  • Save johnnygoodman/548759 to your computer and use it in GitHub Desktop.
Save johnnygoodman/548759 to your computer and use it in GitHub Desktop.
require 'pp'
h = { "1"=>"overallconstruct",
"2"=>
{ "report"=>87396,
"modified"=>"2010-08-09 07:44:39",
"rawamount"=>"36.00",
"category"=>36679,
},
"3"=>1523332}
array = h.select { |k, v| k == "2" }
pp array
#=> [["2",
{"rawamount"=>"36.00",
"modified"=>"2010-08-09 07:44:39",
"report"=>87396,
"category"=>36679}]]
# How can I access the hash inside the returned array? How do I parse down to the second level?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment