Edward Faulkner wrote:
> On Wed, Mar 15, 2006 at 07:23:46AM +0900, Pavel Smerk wrote:
>> However, Jim Weirich's (a[1] <=> b[2]).nonzero? || a[2] <=> b[2] seems OK
> 
> I don't think that actually does what you want.  The test should
> return -1 if a[1] is less than b[2], but instead it will return
> "true".

No, it works:

> (0 <=> 1).nonzero?
=> -1

It was for this exact purpose that nonzero? was introduced.

BTW, I hope no one was confused by the typo ... the first b[2] should 
have been a b[1].

-- Jim Weirich

-- 
Posted via http://www.ruby-forum.com/.