diff --git a/lib/tmpdir.rb b/lib/tmpdir.rb index 967a011..604051a 100644 --- a/lib/tmpdir.rb +++ b/lib/tmpdir.rb @@ -98,13 +98,13 @@ def self.tmpdir # 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