From: Robert Klemme Date: 2005-03-27T02:24:47+09:00 Subject: Re: Instead of templates "Adelle Hartley" schrieb im Newsbeitrag news:courier.42453960.00006AA7@mars.sisgroup.com.au... > ARggh. > >> > > module Extension >> > > # this one is really only neede if you >> > > # want to inherit this behavior automatically >> > > # down the class hierarchy >> > > def inherited(cl) >> > > cl.extend Extension >> > > end > > This is pretty neat if I want to add class methods to child classes. Is > their an equivalent mechanism for adding instance methods? Not needed as they are inherited if you use "normal" module inclusion: >> module Foo; def bar() "bar" end end => nil >> class A >> include Foo >> end => A >> class B < A >> end => nil >> B.new.bar => "bar" Cheers robert