From: Robert Dober Date: 2006-08-04T07:08:17+09:00 Subject: Re: Creating Classes at runtime ------=_Part_95971_26123939.1154642894487 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 8/3/06, ara.t.howard@noaa.gov wrote: > > On Fri, 4 Aug 2006, Robert Dober wrote: > > > > > > > Hmm but that still leaves the OP's question unanswered, how can > I create > > a named class dynamically. > > > > eval "class #{x}; end" > > myref2class =3D Object.const_get(x) > > > > > > obviously does the job. ( I agree seems flawed to me too, but OP might > have > > his reasons ) > > > > I had a quick look into class.c and it seems that rb_define_class is th= e > > only way to define the name of the class object, which would mean that > eval > > is the only way to do the trick. > > > > Any opinnions? > > i think we've come full circle, but you can do > > c =3D Object.const_set 'C', Class.new{} > > i was just unsure it was actually needed Thx I scr**** up on this one, thaught I had tested it. Defenitly nicer than eval. Well I guess that is what OP asked for, which does not necessairily mean i= t is what he wanted. :( or even less what he needed. But it is what I wanted :) to know Thx again. Cheers Robert cheers. > > -a > -- > happiness is not something ready-made. it comes from your own actions. > - h.h. the 14th dali lama > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_95971_26123939.1154642894487--