Consider...

 File.new("file.ext", "w").write data

Is this safe? When will the file be closed? For IO it's said:
"I/O streams are automatically closed when they are claimed by
the garbage collector." Is this true for files as well, (File
is a subclass of IO)?

I know you can do...

 File.open("file.ext", "w"){|f| f.write data}

...., but the first one is shorter and better readable.

gegroet,
Erik V.