From: Logan Capaldo Date: 2006-07-27T06:53:24+09:00 Subject: Re: Automagic class prototyping On Jul 26, 2006, at 1:40 AM, Aleks Kissinger wrote: > Thanks for the suggestions. The problem with the rescue on NameError > technique is the exception gets thrown before we're actually in the > method body of allow, since the offender is a parameter. I dig the > idea of combining allow and later, but it gets a little uglier since I > really need allow to take multiple args... > > allow {[ClassA, ClassB, OpC]} > > However, thats nicer looking than some of the other alternatives. If > there was some sort of hook or metaprogramming magic that would delay > executing class bodies until everything was defined, that would be > ideal, but that might be stretching a little too far. > how about: class Sec def self.const_missing(constant_name) Object.const_set(constant_name, Class.new(Sec)) end end