[ruby/tmpdir] Tell if the block is given by block argument
https://github.com/ruby/tmpdir/commit/6e97a96d3b
This commit is contained in:
parent
bf0f323907
commit
0769a48a21
@ -98,13 +98,13 @@ class Dir
|
|||||||
# FileUtils.remove_entry dir
|
# FileUtils.remove_entry dir
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
def self.mktmpdir(prefix_suffix=nil, *rest, **options)
|
def self.mktmpdir(prefix_suffix=nil, *rest, **options, &block)
|
||||||
base = nil
|
base = nil
|
||||||
path = Tmpname.create(prefix_suffix || "d", *rest, **options) {|path, _, _, d|
|
path = Tmpname.create(prefix_suffix || "d", *rest, **options) {|path, _, _, d|
|
||||||
base = d
|
base = d
|
||||||
mkdir(path, 0700)
|
mkdir(path, 0700)
|
||||||
}
|
}
|
||||||
if block_given?
|
if block
|
||||||
begin
|
begin
|
||||||
yield path.dup
|
yield path.dup
|
||||||
ensure
|
ensure
|
||||||
|
Loading…
x
Reference in New Issue
Block a user