Edgardo Hames wrote: > On Wed, 6 Oct 2004 02:24:12 +0900, Brian Schröäer > <ruby / brian-schroeder.de> wrote: > >>Anybody has an idea for an exercise on extending existing classes. So >>far the only thing I have come up with is: >> > > > Taken from the Design Patterns book, Decorator pattern: > > "Attach additional responsibilities to an object dynamically. > Decorators provide a flexible alternative to subclassing for extending > functionality." > > You could extend Integer with a fibonacci method, so that you can > write something like: > > puts 0.fibonacci > 0 > puts 1.fibonacci > 1 > puts 5.fibonacci > 5 Should be 12, shouldn't it? > > My 2 cents. > Ed > I'm sorry, but this was exactly the example I gave. It seems we have a similar mindset ;) Regards, Brian -- Brian Schröäer http://ruby.brian-schroeder.de/