I would like to return an hash array based on a combination of sport and type
I have the following array:
[ { sport: "football", type: 11, other_key: 5 }, { sport: "football", type: 12, othey_key: 100 }, { sport: "football", type: 11, othey_key: 700 }, { sport: "basketball", type: 11, othey_key: 200 }, { sport: "basketball", type: 11, othey_key: 500 } ]
I would like to return:
[ { sport: "football", type: 11, other_key: 5 }, { sport: "football", type: 12, othey_key: 100 }, { sport: "basketball", type: 11, othey_key: 200 }, ]
I tried using (pseudo code):
[{}, {}, {}].uniq { |m| m.sport and m.type }
I know that I can create such an array with loops, I'm completely new to rubies, and I'm curious if there is a better (more elegant) way to do this.