Sha256: 202b995276b85206443761ef8699445cf2f2ccd9811d5159a899f4b4a71f71c0

Contents?: true

Size: 414 Bytes

Versions: 1

Compression:

Stored size: 414 Bytes

Contents

require 'tmpdir'
module Astrails
  module Safe
    module TmpFile
      @KEEP_FILES = []
      TMPDIR = Dir.mktmpdir

      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

1 entries across 1 versions & 1 rubygems

Version Path
astrails-safe-0.0.8 lib/astrails/safe/tmp_file.rb