On Aug 23, 2007, at 5:45 AM, Gregor Kopp wrote:

> Another way:
>
> class Object
>   def with &block
>     yield self
>   end
> end
>
> verylongobject = "Hakuna Matata!"
>
> verylongobject.with do |o|
>   puts o #-> Kakuna Matata!
>   puts o.length #-> 14
>   puts o.reverse #-> !atataM anukaH
>   puts o.upcase #-> HAKUNA MATATA!
> end

With a small modification the OP can get exactly the syntactic form  
he wants:

<code>
def with obj
    yield obj
end

verylongobject = "Hakuna Matata!"

with verylongobject do |o|
   o # => "Hakuna Matata!"
   o.length # => 14
   o.reverse # => "!atataM anukaH"
   o.upcase # => "HAKUNA MATATA!"
end
</code>

Regards, Morton