On 7/31/06, ts <decoux / moulon.inra.fr> wrote:
> >>>>> "P" == =?ISO-8859-1?Q?Pedro C=F4rte-Real?= <ISO-8859-1> writes:
>
> P> And the strange thing is that 'At the end' isn't printed but 'At the
> P> start' is. How can this be?
>
>  Comparable#== catch StandardError
>
> moulon% /usr/bin/ruby -v -e 'p NameError.ancestors'
> ruby 1.8.4 (2005-12-24) [i486-linux]
> [NameError, StandardError, Exception, Object, Kernel]
> moulon%
>
>
> moulon% ruby -v -e 'p NameError.ancestors'
> ruby 1.9.0 (2006-07-14) [i686-linux]
> [NameError, ScriptError, Exception, Object, Kernel, BasicObject]
> moulon%

Ah, right, the exception is being caught. Here's a working version then:

def <=>(other)
  VALS.map{|key| self.send(key)||0} <=> VALS.map{|key| other.send(key)||0}
end

Much cleaner than my first and this time it actually works.

Pedro.