I have an array of Products
, each of which has a name and a category. I would like to produce a hash in which each key is a category string and each element is a product with that category, akin to the following:
{ "Apple" => [ <Golden Delicious>, <Granny Smith> ], ...
"Banana" => ...
Is this possible?