"Pit Capitain" <pit / capitain.de> schrieb im Newsbeitrag
news:41FA17DF.1060206 / capitain.de...
> Robert Klemme schrieb:
> > "Pit Capitain" <pit / capitain.de> schrieb im Newsbeitrag
> > news:41F9E97C.2030006 / capitain.de...
> >
> >>Trans schrieb:
> >>
> >>>(...) though I would like to figure
> >>>out how to copy classes and give them a name, instead of them
> >>>appearing as numbers on #inspect.
> >>>
> ..
> >>
> >>   c = String.dup
> >>
> >>   def c.to_s
> >>     "MySpecialString"
> >>   end
> >>
> ..
>  >
> > I guess that's not the same as there is some magic involved with class
> > names:
> >
> ..
>
> Hi Robert,
>
> I thought Tom was talking about the textual representation of his class
copies
> when calling inspect on them. My simple code was an answer to this
problem.

Ah, ok.  Although in that case you probably want to override #inspect.

> I didn't talk about the name of a class object as returned by the name
method.
> IIRC it has been mentioned at least once on this mailing list that the
name of a
> class object is the name of the first constant this class object is
assigned to,
> as your code shows.

Yep.

Regards

    robert