On Saturday, August 9, 2003, 8:31:47 PM, Martin wrote:

> Florian Frank <flori / nixe.ping.de> wrote:
>> 
>>    def <=>(other)
>>        (self.freq <=> other.freq).nonzero? || other.time <=> self.time 
>>    end

> Shouldn't that be

> def <=>(other)
>   a = (self.freq <=> other.freq)
>   a.nonzero? ? a : (other.time <=> self.time)
> end

> since calling nonzero? collapses [-1,1] to 'true'.


Actually, I fancy

  def <=>(other)
    [self.freq, self.time] <=> [other.freq, other.time]
  end

I don't know if it works, but I fancy it.  Given what I know about
Ruby, I'd be surprised if it *didn't* work.

Gavin