From: Robert Klemme Date: 2006-03-03T22:53:38+09:00 Subject: Re: Array comparison returning nil 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? Improper implemented <=> method on one of the array members: >> o=Object.new => # >> def o.<=>(x) nil end => nil >> [o] <=> [1] => nil Kind regards robert