From: come Date: 2007-08-23T16:30:05+09:00 Subject: Changing "self" for cleaner code 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") => # irb(main):002:0> irb f irb#1(#):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