Stephen Waits
3/3/2006 5:14:00 PM
On Mar 3, 2006, at 5:37 AM, Julian Gall wrote:
> I am comparing two arrays with:
>
> original_item_ids.sort <=> new_item_ids.sort
>
> However, this returns nil, which seems to be against the documentation
> which says the result will be -1, 0 or 1. Both arrays contain the same
> values, alhough in a different order, hence the sort.
>
> Does anyone know of any circumstance that would cause this?
It works for me...
% irb
irb(main):001:0> a = [1,2,3]
=> [1, 2, 3]
irb(main):002:0> b = [3,1,2]
=> [3, 1, 2]
irb(main):003:0> a.sort <=> b.sort
=> 0
Maybe you could post an irb session of your own so we could see
what's happening?
--Steve