From: Eric Mahurin Date: 2005-06-07T22:03:41+09:00 Subject: Re: making a duck --- nobu.nokada@softhome.net wrote: > At Tue, 7 Jun 2005 11:59:47 +0900, > Eric Mahurin wrote in [ruby-talk:144750]: > > Is there an advantage to having a separate Behavior class > as > > opposed the solution I had: making a singleton Object > directly? > > To allow sharing same behavior. I'm not sure how much application this would have over the conventional class definition approach. At first I didn't think this would work because I thought you wouldn't be able to create any instance variables using define_method. I thought any @ variables in a proc would refer to the @ variable in the original context, but define_method apparently rebinds them to the object. __________________________________ Discover Yahoo! Use Yahoo! to plan a weekend, have fun online and more. Check it out! http://discover.yahoo.com/