From: Chad Perrin Date: 2007-03-21T10:09:36+09:00 Subject: Re: does Ruby not support multiple "initialize" methods for a class??? On Wed, Mar 21, 2007 at 08:32:37AM +0900, johan556@gmail.com wrote: > On 3/20/07, Greg Hauptmann wrote: > >Hi, > > > >Q1 - Does Ruby not support multiple "initialize" methods for a class? > > > >Q2 - If no is there a reason for this out of curiosity? > > > >Q3 - What approach is recommended if this constraint does exist? > > > > I have been using the following pattern to implement multiple > constructors for a class. It is only a variation of the already > proposed solutions, but by using "instance_eval" I could avoid having > to create separate new/initialize-like methods for each constructor. I've heard it said -- and I tend to agree -- that regular use of "patterns" is a sign that the language lacks something. I wonder if that is the case with Ruby, as applies to multiple constructor behavior implementation. I say "wonder" because I really am not certain in this case. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Leon Festinger: "A man with a conviction is a hard man to change. Tell him you disagree and he turns away. Show him facts and figures and he questions your sources. Appeal to logic and he fails to see your point."