Its Me
11/9/2004 2:10:00 PM
Both const_set and direct assignment have the class created first, so the
"inherited" callback has already been completed. I guess to test my usage of
that callback I have to resort to one of the evals.
Thanks for the help.
"Robert Klemme" <bob.news@gmx.net> wrote in message
news:2vbepuF2g6vfnU1@uni-berlin.de...
>
> "Florian Gross" <flgr@ccan.de> schrieb im Newsbeitrag
> news:2va204F2ie5e5U1@uni-berlin.de...
> > itsme213 wrote:
> >
> > > Is there a way to give a name to the class? My code generation uses
> the
> > > class name. I tried assigning it to a constant but get an error:
> > > "dynamic constant assignment"
> >
> > Yup, via Object.const_set("Foo", Class.new).
>
> Direct assignment works, too:
>
> >> Foo = Class.new String
> => Foo
> >> Foo.superclass
> => String
> >> Foo.ancestors
> => [Foo, String, Enumerable, Comparable, Object, Kernel]
> >> Foo.name
> => "Foo"
> >>
>
> Kind regards
>
> robert
>