Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!talisker.lacave.net!lacave.net!not-for-mail From: Brian Candler Newsgroups: comp.lang.ruby Subject: Re: Autoconvert object from one class1 to other class2 in class1 def Date: Tue, 5 Apr 2011 03:46:32 -0500 Organization: Service de news de lacave.net Lines: 16 Message-ID: <3962d67dedc7aa2c534540d17939bf1a@ruby-forum.com> References: <5095fcbac456c1c2b31e5c05fbea960d@ruby-forum.com> NNTP-Posting-Host: bristol.highgroove.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: talisker.lacave.net 1301993226 3388 65.111.164.187 (5 Apr 2011 08:47:06 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Tue, 5 Apr 2011 08:47:06 +0000 (UTC) In-Reply-To: <5095fcbac456c1c2b31e5c05fbea960d@ruby-forum.com> X-Received-From: This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway X-Mail-Count: 380966 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <3962d67dedc7aa2c534540d17939bf1a@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:2305 Luk Mus wrote in post #990946: > Is it possible to convert from one Class1 to another Class2 within the > functions of the Class1? No, an object cannot change its class. All you can do is return a new object of a different class. > or how get name of variable in class method? That's not possible either. The same object could be pointed to by many variables (local and/or global and/or instance), or by none. For example, maybe the only reference to the object is as a value in a Hash. -- Posted via http://www.ruby-forum.com/.