Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!weretis.net!feeder5.news.weretis.net!talisker.lacave.net!lacave.net!not-for-mail From: Luk Mus Newsgroups: comp.lang.ruby Subject: Autoconvert object from one class1 to other class2 in class1 def Date: Tue, 5 Apr 2011 03:02:26 -0500 Organization: Service de news de lacave.net Lines: 21 Message-ID: <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 1301990820 99010 65.111.164.187 (5 Apr 2011 08:07:00 GMT) X-Complaints-To: abuse@lacave.net NNTP-Posting-Date: Tue, 5 Apr 2011 08:07:00 +0000 (UTC) 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: 380963 X-Ml-Name: ruby-talk X-Rubymirror: Yes X-Ruby-Talk: <5095fcbac456c1c2b31e5c05fbea960d@ruby-forum.com> Xref: x330-a1.tempe.blueboxinc.net comp.lang.ruby:2302 Is it possible to convert from one Class1 to another Class2 within the functions of the Class1? Example: class String def to_i! self=self.to_i end end c='1' # c='1' - String c.to_i! # c=1 - Integer Previous code is wrong, error: Can't change the value of self self=self.to_i -- Posted via http://www.ruby-forum.com/.