Ruby Tempfile Functions

EditRocket provides the following information on Tempfile functions in the Ruby source code builder.

close!() - Closes and unlinks the file.

close(unlink_now=false) - Closes the file. If the optional flag is true, unlinks the file after closing.

delete() - "Alias for #unlink"

length() - "Alias for #size"

new(basename, tmpdir=Dir::tmpdir) - Creates a temporary file of mode 0600 in the temporary directory whose name is basename.pid.n and opens with mode "w+". A Tempfile object works just like a File object.

open(*args) - If no block is given, this is a synonym for new().

open(*args) - If no block is given, this is a synonym for new().

path() - Returns the full path name of the temporary file.

size() - Returns the size of the temporary file. As a side effect, the IO buffer is flushed before determining the size.

unlink() - Unlinks the file. On UNIX-like systems, it is often a good idea to unlink a temporary file immediately after creating and opening it, because it leaves other programs zero chance to access the file.