Robert Klemme wrote: > 2010/6/30 Brian Candler <b.candler / pobox.com>: >> or rather: >> >> Tempfile.open "prefix", "/tmp" do |io| >> io.write everything >> io.flush > > I'd rather io.close instead of io.flush to release resources as soon > as possible. But tempfile will want to close itself using the block form anyway. In most versions of ruby, Tempfile with a block returns nil. A change was committed so that it returns the (closed) object, but that hasn't made it into either of the versions I have lying around here. >> tf = Tempfile.open("aaa","/tmp") { puts "hello"; 123 } hello => nil -- Posted via http://www.ruby-forum.com/.