From: Nathan Olberding Date: 2006-05-03T06:04:43+09:00 Subject: Re: Mixin Syntax for Newbies Simen wrote: >> If you make it a method, you can call it from initialize: >> >> module One >> def one; @one = "One!"; end >> end >> class Two >> def initialize >> one >> puts @one >> end >> end >> # Outputs "One!" >> two = Two.new > > Whoops, you need to include One first: > > class Two > include One > ... > end Is there a way to do this without having to re-initialize variables in each inheriting class? > ( I gotta stop using the ruby-forum gateway. It's so easy it makes me > sloppy ). Fast answers mean fast self-checking! It's a tradeoff I'm willing to live with. -- Posted via http://www.ruby-forum.com/.