From: Robert Klemme Date: 2004-11-11T20:03:33+09:00 Subject: Re: hook for class creation "Jamis Buck" schrieb im Newsbeitrag news:41927269.1020701@email.byu.edu... > Florian Gross wrote: > > itsme213 wrote: > > > >> Is there a hook method called whenever a new class is created i.e. > >> guaranteed called for every new instance of Class ? > > > > > > You can try Object.inherited, but I'm not sure if it will get called > > when a class is created internally in C code. > > > > Plus it can be overridden in subclasses so there is no 100% guarantee of > > it getting called. > > > > . > > > > What about just putting the initialization code in the class definition? > > class Foo > def bar > ... > end > ... > # class init > do_something > do_something_else > end I think 213 wanted some automated mechanism, so you can't forget it when you create a new class. robert