From: "Berger, Daniel" Date: 2005-05-17T03:46:46+09:00 Subject: Re: Forwardable, reworked > -----Original Message----- > From: news [mailto:news@sea.gmane.org] On Behalf Of Florian Gro� > Sent: Monday, May 16, 2005 12:35 PM > To: ruby-core@ruby-lang.org > Subject: Re: Forwardable, reworked > > > Daniel Berger wrote: > > > A while back I mentioned that there were warnings > > coming from the Forwardable module. Because I would > > like to use it with another project I'm working on, I > > decided to refactor it (attached). > > > > Please let me know what you think. > > Nice work! I wonder if you could also add a nicer interface while you > are here enhancing things. I'd like to do this: > > class Foo > extend Forwardable > > delegate :to_i => :@number > delegate [:to_s, :reverse] => :@string > > def initialize > @number = 5 > @string = "foobar" > end > end That *does* look nicer. We should keep the older methods around for backwards compatability, though, unless folks don't care. I don't get the impression that many people are using this. :) Regards, Dan