Andrea Fazzi
5/11/2008 11:21:00 AM
Lucas L. ha scritto:
> To me it seems it should be a rather obvious thing, but no matter where
> I look, I can't find how to erase text from a file or clear a file. The
> only things I have found are moving the the cursor to the start and
> writing more text over it (but that doesn't get rid of it), or reopening
> the file.
>
> Is there a way to simple erase text from the file?
>
> Thanks,
> Lucas
>
File.open('file.txt', 'w') { |file| file = nil }