From: Pit Capitain Date: 2005-01-28T19:46:09+09:00 Subject: Re: Duping a class causes error Robert Klemme schrieb: > "Pit Capitain" 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. 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. Regards, Pit