What is the best way to create an empty file in Ruby?
Something similar to the Unix command, touch:
touch file.txt
In Ruby 1.9.3+, you can use File.write (a.k.a IO.write):
File.write
File.write("foo.txt", "")
For earlier version, either require "backports/1.9.3/file/write" or use File.open("foo.txt", "w") {}
File.open("foo.txt", "w") {}