From: Phrogz Date: 2007-12-19T10:05:01+09:00 Subject: Re: Hash#collate On Dec 18, 5:16 pm, Joel VanderWerf wrote: > Phrogz wrote: > > # { :a=>1, :b=>2 }.collate :a=>3, :b=>4, :c=>5 > > # #=> { :a=>[1,3], :b=>[2,4], :c=>[5] } > > Do these two give the same result? Does it matter? > > { :a=>1, :b=>2 }.collate :a=>3, :b=>4, :c=>5 > { :a=>1, :b=>2, :c=>5 }.collate :a=>3, :b=>4 They don't. In my particular use case today, I only used the result as a set, so a proper Set might have been more appropriate. But I don't know; I think that preserving the order is probably useful, at least when not using the #uniq option. (I'm thinking perhaps of a case where you're specifying a series of fallback results for a variety of options.) Totally up for grabs, though, if there's a faster, more elegant solution that doesn't use that.