From: torehalv@... (Tore Halvorsen) Date: 2004-09-18T01:00:01+09:00 Subject: Re: Automatic class conversion / function overloading Markus wrote: >Which would permit types other than Fixnum, provided they implemented >to_rational. Taking this to its logical conclusion I would surely then >rewrite it as: > >class Fixnum > def to_rational > Rational.new(self,1) > end > end > >class Rational > attr_reader :u, :d > def to_rational > self > end > def *(other) > other = other.to_rational > Rational.new(self.u * other.u, self.d * other.d) > end > end > >..which eliminates all class testing and is fairly easily extensible. >But of course others might have different solutions. Thanks :) .. o O (You learn something every day) -- Eld p� �ren og sol p� eng gjer mannen fegen og fj�g. [J�tul] /o)\ 2004 Tore Halvorsen || Cell: +052 0553034554 \(o/