lib/tempdir.rb

# TempDir - The class for hierarchical temporary directories.

`TempDir.global([keyword])`
`TempDir.global([keyword]) {|oldname| ...}`

    returns a temporary directory shared by the process.

`TempDir.create([keyword])`
`TempDir.create([keyword]) {|oldname| ...}`

    creates temporary subdirectory under a process wide shared temporary
    directory.

`TempDir.new([keyword])`
`TempDir.new([keyword]) {|oldname| ...}`

    creates a new temporary directory and
    returns associated temporary directory object.
    `keyword' is used for prefix of temporary directory name.

    The temporary directory and all files under the directory is removed when
    the associated temporary directory object is collected as garbage.

    If a block is given, it is used to generate new filenames under the
    temporary directory.  It is called when new filename is requried.
    At first time it is called with nil as an argument and
    with previous filename for succeeding calls.
    If a block is not given, String#succ is used to generate filenames:
    `a', ..., `z', `aa', ..., `zz', `aaa', ...

`path([name])`

    returns an absolute path.

    If `name' is not specified, an absolute path to the temporary directory is returned.
    If `name' is specified, `temporary directory'/`name' is returned.

`newpath`

    returns an absolute path for fresh temporary file.

`mkdir([name])`

    creates a directory under the temporary directory and
    returns an absolute path to the created directory.

    The name of created directory is specified by `name'.
    If it is not specified, the name is automatically generated.

    The created directory and its components are removed when the containing
    temporary directory is removed.

`open(name[, mode])`
`open(name[, mode]) {|file| ...}`

    opens a file under the temporary directory.

`newdir([name])`
`newdir([name]) {|oldname| ...}`
`create([name])`
`create([name]) {|oldname| ...}`

    creates a temporary directory under the temporary directory and
    returns associated temporary directory object.

    The created temporary directory and all files under the directory is
    removed when the associated temporary directory object is collected
    as garbage.
    Note that parent directory object doesn't collected until all subdirectory
    objects are collected because a subdirectory object refer the parent
    temporary directory object.