Sha256: ce8350060b1039ee147ce9b3c2dfc1715d761cc1d84bb70e5daa24458f98e8b3
Contents?: true
Size: 493 Bytes
Versions: 12
Compression:
Stored size: 493 Bytes
Contents
require 'tmpdir' module Astrails module Safe module TmpFile @KEEP_FILES = [] TMPDIR = Dir.mktmpdir def self.cleanup FileUtils.remove_entry_secure TMPDIR end 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 end end end
Version data entries
12 entries across 12 versions & 4 rubygems