ハッシュの配列があり、ハッシュ間の一致する値に基づいて一致を見つけて保存する必要があります。Rubyハッシュで重複を検索する
a = [{:id => 1, :name => "Jim", :email => "[email protected]"},
{:id => 2, :name => "Paul", :email => "[email protected]"},
{:id => 3, :name => "Tom", :email => "[email protected]"},
{:id => 1, :name => "Jim", :email => "[email protected]"},
{:id => 5, :name => "Tom", :email => "[email protected]"},
{:id => 6, :name => "Jim", :email => "[email protected]"}]
だから私は
b = [{:id => 1, :name => "Jim", :email => "[email protected]"},
{:id => 3, :name => "Tom", :email => "[email protected]"},
{:id => 5, :name => "Tom", :email => "[email protected]"},
{:id => 6, :name => "Jim", :email => "[email protected]"}]
ノートを返すようにしたいでしょう:彼らはうまくだけで、正確で、グループ化する必要はありませんので、私は事実の後:name
によるデータ(CSV)を並べ替えることができます。同じことの2つの必要はありません、それは3または10以上になる可能性があります。
また、データは約22,000行です。
私がしようとしていることは 'uniq! 'の反対ですが、私はそれをどのように処理するかを正確に理解することができませんでした。 – lyonsinbeta