h1. file-temp The file-temp library replaces the tempfile library in MRI. It has several advantages over MRI's tempfile library. * Relies on your system's _mkstemp()_ function, so no race conditions. * Improved security, using _umask()_ to restrict permissions on temporary files. * Subclasses the File class, giving you all of those methods and a familiar (and better) interface. Only the constructor is different. h2. Synopsis
require 'file/temp' # Automatically delete the file when finished fh = FileTemp.new fh.puts "hello" fh.close # Allow the temp file to live on in your FileTemp::TMPDIR directory. fh = FileTemp.new(false) fh.puts "world" fh.close # Specify a custom naming template FileTemp.new(false, 'my_template_XXXXXX') do |fh| fh.puts "test" end