From: Peter Vandenabeele Date: 2011-12-31T21:14:41+09:00 Subject: Re: output file from variable --20cf3074d7922c1d4d04b5624b12 Content-Type: text/plain; charset=UTF-8 On Sat, Dec 31, 2011 at 2:28 AM, Yong Li wrote: > Beside what Peter has described, one more hint: you probably need to > close your file before calling the rename method. > > You can close your file by calling x.close > You are correct, but I think it is better to advise the OP to open the File in a block, as I demonstrated: 004:0> File.open("original") do |f| 005:1* puts f.readline 006:1> end The main reason is that this will still close the file even if an exception would occur (see IO.open for documentation). Peter -- Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com --20cf3074d7922c1d4d04b5624b12--