From: Kent Dahl Date: 2003-08-09T19:31:49+09:00 Subject: Re: Ruby and OOP-design (question of an old "procedural person" ;) Martin DeMello wrote: > 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'. That was my gut reaction at first but: $ ruby1.8 -v -e "p( -5.nonzero?, 5.nonzero?, 0.nonzero? )" ruby 1.8.0 (2003-08-04) [i686-linux] -5 5 nil That is the beauty of only nil and false being false... -- (\[ Kent Dahl ]/)_ _~_ _____[ http://www.pvv.org/~kentda/ ]_____/~ ))\_student_/(( \__d L b__/ (pre-) Master of Science in Technology ) ( \__\_�|�_/__/ ) _)Industrial economics and technological management( \____/_�_\____/ (____engineering.discipline_=_Computer::Technology___)