I have an array of arrays like so:
[[1,"A"], [1,"B"], [2,"C"], [2,"D"]]
I’d like to get the results into a Hash like so:
1 => {results => ["A","B"]}, 2 => {results => ["C","D"]}
I tried using the “group_by” methods and wasn’t able to get it into this form. What’s the most efficient way to do this?
Any ideas?
Is this what you want?
Or, if you really want a hashtable of hashtable with a ‘result’ key: