From: David Alan Black Date: 2002-04-20T00:47:17+09:00 Subject: Re: Replacing groups of methods: How would *you* do this? Hi -- On Sat, 20 Apr 2002, Hal E. Fulton wrote: > ----- Original Message ----- > From: "David Alan Black" > To: "ruby-talk ML" > Sent: Friday, April 19, 2002 8:45 AM > Subject: Re: Replacing groups of methods: How would *you* do this? > > > > > > Could you do conditional execution? > > > > if condition > > class Thing > > # redefine methods > > end > > end > > > > I could, but I dislike if-statements that > are miles long. > > And there's no way to encapsulate this, > either, as far as I can see. Oh, I could > put it into a here-doc and eval it later... > but boy, is that ugly. > > I guess now I'm leaning toward the > separate-file thing... How about: class Thing if condition include SomeModule elsif other_condition include SomeOtherModule ... end end ? David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav