I have an array of hashes, and I want the unique values out of it. Calling Array.uniq doesn\'t give me what I expect.
Array.uniq
a = [{:a => 1},{:a =&g
I can get what I want by calling inject
inject
a = [{:a => 1},{:a => 2}, {:a => 1}] a.inject([]) { |result,h| result << h unless result.include?(h); result }
This will return:
[{:a=>1}, {:a=>2}]