Sha256: d0e259dbb83da32d20ca94eb102c8f9f6f93deb5221d578a28c08580dee377a7
Contents?: true
Size: 558 Bytes
Versions: 4
Compression:
Stored size: 558 Bytes
Contents
require 'tmpdir' module Astrails module Safe module TmpFile @keep_files = [] def self.tmproot @tmproot ||= Dir.mktmpdir end def self.cleanup FileUtils.remove_entry_secure tmproot @tmproot = nil end def self.create(name) # create temp directory file = Tempfile.new(name, tmproot) yield file file.close @keep_files << file # so that it will not get gcollected and removed from filesystem until the end file.path end end end end
Version data entries
4 entries across 4 versions & 1 rubygems