I have a hash, @data looking similar to the following:
{
"calcData" => {
"coverStartDate" =>"10/08/2011",
...
"part"=> [
{
"licenceYears" =>"10",
"licenceType" =>"1",
...
"@partname" =>"ratingData"
},
{
"dob" =>"26/01/1964",
"age" =>"47",
...
"@partname" =>"driver"
},
...
]
}
}
There are various more sections in the part bit with difference @partnames.
What is the best way to select one of these @partname bits:
e.g.:
@data["calcData"]["part <<< where @partname="ratingData" >>> "]["licenceYears"]
How can I represent this logic in ruby/rails?
1 Answer