Module: Ftpd::TempDir
- Defined in:
- lib/ftpd/temp_dir.rb
Overview
Create temporary directories that will be removed when the program exits.
Class Method Summary collapse
-
.make ⇒ Object
Create a temporary directory, returning its path.
Class Method Details
.make ⇒ Object
Create a temporary directory, returning its path. When the program exists, the directory (and its contents) are removed.
13 14 15 16 17 18 19 20 |
# File 'lib/ftpd/temp_dir.rb', line 13 def make Dir.mktmpdir.tap do |path| at_exit do FileUtils.rm_rf path Dir.rmdir(path) if File.exist?(path) end end end |