From: Brian Candler Date: 2010-08-12T17:00:06+09:00 Subject: Re: Can't change the value of self - II Ralph Shnelvar wrote: > Could you expand on this with an example, please? [Just to show that delegation is nothing magic, and you don't need to use the Delegator class] class MyCounter def initialize(n=0) @n = n end def inc! @n += 1 end def to_int @n end def to_s @n.to_s end end c = MyCounter.new c.inc! c.inc! puts "c is #{c}" Some more work is required to make c duck-type like an Integer though. -- Posted via http://www.ruby-forum.com/.