temp_file = TempFile.new('name')
temp_file.unlink
That won't blow nor delete the file.
Right now it just logs a warning asking to close the file before unlink.
That make sense if the file is actually opened but TempFile.new show create the file and the file reference without opening the stream.
Note that the problem is not present on other Ruby implementations.
Btw, the following will work great.
temp_file = TempFile.new('name')
temp_file.close
temp_file.unlink