Phrogz
12/13/2007 5:30:00 PM
On Dec 13, 10:29 am, Phrogz <phr...@mac.com> wrote:
> On Dec 13, 8:27 am, Sebastian Hungerecker <sep...@googlemail.com>
> wrote:
>
> > Mike McKinney wrote:
> > > File.open('out.txt', 'w') do |out|
> > > File.open('test.txt', 'r').each do |line|
> > > out.puts line if (line.size > 4)
> > > end
> > > end
>
> > That leaves test.txt open which is not good. Don't use File.open in chains
> > like that. Or better yet: Don't use File.open without a block at all.
>
> He is using the block form of File.open, which is guaranteed to close
> the file at the end. Right?
Nevermind; my reading comprehension seems to be turned off this
morning.