[ruby/tmpdir] Tell if the block is given by block argument

https://github.com/ruby/tmpdir/commit/6e97a96d3b
This commit is contained in:
Nobuyoshi Nakada 2024-04-08 18:28:34 +09:00 committed by git
parent bf0f323907
commit 0769a48a21

View File

@ -98,13 +98,13 @@ class Dir
# FileUtils.remove_entry dir
# end
#
def self.mktmpdir(prefix_suffix=nil, *rest, **options)
def self.mktmpdir(prefix_suffix=nil, *rest, **options, &block)
base = nil
path = Tmpname.create(prefix_suffix || "d", *rest, **options) {|path, _, _, d|
base = d
mkdir(path, 0700)
}
if block_given?
if block
begin
yield path.dup
ensure