Sha256: 5b20c6f37c4af7bf245742be5791da2895d056070054864f4e5d7580f60fe0b1

Contents?: true

Size: 490 Bytes

Versions: 6

Compression:

Stored size: 490 Bytes

Contents

# frozen_string_literal: true

module Ftpd

  # Create temporary directories that will be removed when the program
  # exits.

  module TempDir

    # Create a temporary directory, returning its path.  When the
    # program exists, the directory (and its contents) are removed.

    def make
      Dir.mktmpdir.tap do |path|
        at_exit do
          FileUtils.rm_rf path
          Dir.rmdir path if File.exists?(path)
        end
      end
    end
    module_function :make

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ftpd-2.0.5 lib/ftpd/temp_dir.rb
ftpd-2.0.4 lib/ftpd/temp_dir.rb
ftpd-2.0.3 lib/ftpd/temp_dir.rb
ftpd-2.0.2 lib/ftpd/temp_dir.rb
ftpd-2.0.1 lib/ftpd/temp_dir.rb
ftpd-2.0.0 lib/ftpd/temp_dir.rb