From: Joel VanderWerf Date: 2006-05-23T06:38:08+09:00 Subject: Re: initializing instance variables in a module Francis Cianfrocca wrote: > Looks promising but what if you have to assign to the variable? This code > throws an exception: > > module Mixin > def myvar > @myvar ||= 100 > @myvar > end > > def inc_myvar > myvar += 1 self.myvar += 1 > end > end > > class Klass > include Mixin > end > > Klass.new.inc_myvar -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407