class method
Pathname.mktmpdir
mktmpdir() { |dir| ... }
lib/pathname.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/pathname.rb, line 63
def self.mktmpdir
require 'tmpdir' unless defined?(Dir.mktmpdir)
if block_given?
Dir.mktmpdir do |dir|
dir = self.new(dir)
yield dir
end
else
self.new(Dir.mktmpdir)
end
end
Creates a tmp directory and wraps the returned path in a Pathname object.
Note that you need to require ‘pathname’ to use this method.
See Dir.mktmpdir