From: Robert Dober Date: 2010-09-01T22:49:31+09:00 Subject: Re: Array#=== as set equality On Wed, Sep 1, 2010 at 11:03 AM, Intransition wrote: > It looks like Array#== and Array#=== are the same. Is that correct? > That being so, would there be any serious consequences if Array#=== > were redefined to mean "set equality", e.g. I'd prefer > >  [:a,:b] === [:b,:a]    #=> true > > I can think of a few times that would have been nice to have, > especially when testing and hashes come into play, the results often > do not have a fixed order. e.g. > >  h = {:a=>1, :b=>2} >  r = h.map{ |k,v| [k,v] } > >  assert  r == [[:a,1], [:b,2]] yup but in your case could you not do something like assert_equal h, Hash[*r.flatten] I say that because I'd prefer #=== to have the semantics of include?, so that I can do case some_value when some_array when other_array end Cheers Robert > > won't work b/c it might also return > >  [[:b,2], [:a,1]] > > -- The best way to predict the future is to invent it. -- Alan Kay