How do I get the unique elements from an array of hashes in Ruby?

后端 未结 8 1053
抹茶落季
抹茶落季 2020-12-28 14:57

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.

a = [{:a => 1},{:a =&g         


        
8条回答
  •  离开以前
    2020-12-28 15:36

    found on google http://mikeburnscoder.wordpress.com/2008/01/18/uniquify-an-array-of-hashes-in-ruby/

提交回复
热议问题