From: Adelle Hartley Date: 2005-03-25T10:46:33+09:00 Subject: Re: Instead of templates Robert Klemme wrote: > You cannot use super here, because super refers to the > superclass of the class instance. All class instances have > the same super class hierarchy: > > >> String.class.ancestors > => [Class, Module, Object, Kernel] > >> Fixnum.class.ancestors > => [Class, Module, Object, Kernel] > > You need Class#superclass: > > > class MyBase > > def self.do_my_thing(klass=self) > > p '-----' > > end > > end > > > > module Extension > > def inherited(cl) > > cl.extend Extension > > end > > > > def do_my_thing(klass=self) > > p klass > > superclass.do_my_thing > > > end > > end > > > > And, btw, you don't need the class argument. You can print > self instead. > Fantastisch!! You have not only shown me how to do what I want but also how to do it in a truly elegant way. Adelle.