Joel VanderWerf wrote: > 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 Oops... forgot this, obviously (attr_writer is an alternative): def myvar=(val) @myvar = val 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