Method: Dir::MakeDirs#tmp

Defined in:
lib/vex/base/filesystem/make_dirs.rb

#tmp(do_unlink = true, &block) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/vex/base/filesystem/make_dirs.rb', line 33

def tmp(do_unlink = true, &block)
  path = "#{App.tmpdir}/#{$$}_#{Thread.current.object_id}"
  Dir.mkdirs path
  
  r = yield(path)
ensure
  Dir.rmdirs(path) if path && do_unlink
end