From: Alex Fenton Date: 2008-05-28T22:45:01+09:00 Subject: Re: Merge collections of objects John Butler wrote: > Hi, > > I wonder if there is a quick way to do this. > > companyA has 2 employees "a", "b" > > companyB has 3 employees "a", "b", "c" > > I basically want to merge companyA employess with companyB employees so > when i look at companyA the employees will equal "a", "b", "c" Try the "|" method of Array irb(main):001:0> comp_a = %w[a b c] => ["a", "b", "c"] irb(main):002:0> comp_b = %w[a b] => ["a", "b"] irb(main):003:0> comp_a | comp_b => ["a", "b", "c"] irb(main):004:0> comp_a & comp_b => ["a", "b"] a