Module: Astrails::Safe::TmpFile
- Defined in:
- lib/astrails/safe/tmp_file.rb
Constant Summary collapse
Class Method Summary collapse
Class Method Details
.cleanup ⇒ Object
8 9 10 |
# File 'lib/astrails/safe/tmp_file.rb', line 8 def self.cleanup FileUtils.remove_entry_secure TMPDIR end |
.create(name) {|file| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/astrails/safe/tmp_file.rb', line 12 def self.create(name) # create temp directory file = Tempfile.new(name, TMPDIR) yield file file.close @KEEP_FILES << file # so that it will not get gcollected and removed from filesystem until the end file.path end |