From: Gregor Kopp Date: 2007-08-24T16:25:07+09:00 Subject: Re: Changing "self" for cleaner code David A. Black wrote: > Is that better than just calling the methods without a block? Or if > the variable length is a concern: > > o = verylongobject > > > David Your'e right! class Object def with &block yield self end end class Testclass < String end verylongobject = Testclass.new("Hakuna Matata!") puts verylongobject.object_id verylongobject.with do |o| puts o.object_id end o = verylongobject puts o.object_id It gives all the same object_id, so no copies should fly around, so giving it another name should be the best.