lib/kraps/temp_path.rb in kraps-0.5.0 vs lib/kraps/temp_path.rb in kraps-0.6.0
- old
+ new
@@ -1,29 +1,3 @@
module Kraps
- class TempPath
- attr_reader :path
-
- def initialize(prefix: nil, suffix: nil)
- @path = File.join(Dir.tmpdir, [prefix, SecureRandom.hex[0, 16], Process.pid, suffix].compact.join("."))
-
- File.open(@path, File::CREAT | File::EXCL) {}
-
- ObjectSpace.define_finalizer(self, self.class.finalize(@path))
-
- return unless block_given?
-
- begin
- yield
- ensure
- unlink
- end
- end
-
- def unlink
- FileUtils.rm_f(@path)
- end
-
- def self.finalize(path)
- proc { FileUtils.rm_f(path) }
- end
- end
+ TempPath = MapReduce::TempPath
end