Hi,

Is it possible to change the value of self just to enter the context
of an object, like for example in IRB ? For instance, is it possible
to write something like :

File.open("file.txt","w") do
  puts "Hello World"
end

With irb, you could do something like :

irb(main):001:0> f=File.open("_vimrc","r")
=> #<File:_vimrc>
irb(main):002:0> irb f
irb#1(#<File:0x2e3784c>):001:0> a=readlines
=> ["set guifont=Bitstream_Vera_Sans_Mono:h9:cANSI \n", ...

I ask that because I'm doing a program to access different unix os and
I would like to write something like :

with my_server do
  ls("-lrt")
  ps("-efl")
end

instead of

my_server.new do |host|
  host.ls("-lrt")
  host.ps("-efl")
end

Just for cleaner code...

Come