On Tue, 15 May 2001, Yukihiro Matsumoto wrote: > In message "[ruby-talk:15136] Re: How do I alias a class method?" > on 01/05/15, Mathieu Bouchard <matju / sympatico.ca> writes: > |Class#initialize would take (superclass=Object,&proc) as a parameter, that > |is, there'd be a default value. For accessing an already existing class, > |you'd have to use Class#class_eval or Module#module_eval... > Interesting. RCR? I'm not sure what you do want an RCR on. There is already a default value for Class.new; I thought you'd correct on that point. For the rest... here's a snippet of untested (and probably broken) code that should illustrate the principle: class Class alias :initialize :old_initialize def initialize(*args,&proc) old_initialize(*args) module_eval(&proc) end end But it's not so much important, as you can see, because you can do a module_eval right after, and so it can already be like: (Foo = Class.new(Bar)).module_eval { def blah; ... end def bleh; ... end } Which is oh-so-close to: Foo = Class.new(Bar) { def blah; ... end def bleh; ... end } matju