I'm new to ruby and am having a hard time figuring out how to convert an array of arrays into a hash of a hash of an array.
for example, say I have:
[ [38, "s", "hum"],
[38, "t", "foo"],
[38, "t", "bar"],
[45, "s", "hum"],
[45, "t", "ram"],
[52, "s", "hum"],
[52, "t", "cat"],
[52, "t", "dog"]
]
I'm wanting in the end:
{38 => {"s" => ["hum"],
"t" => ["foo", "bar"]
},
45 => {"s" => ["hum"],
"t" => ["ram"]
},
52 => {"s" => ["hum"],
"t" => ["cat", "dog"]
}
}
I've tried group_by and Hash, but neither is giving me what I'm looking for.