Project

General

Profile

Feature #11965 ยป tempfile-create-basename.patch

ksss (Yuki Kurihara), 01/07/2016 04:57 AM

View differences:

lib/tempfile.rb
# ... do something with f ...
# end
#
def Tempfile.create(basename, tmpdir=nil, mode: 0, **options)
def Tempfile.create(basename="", tmpdir=nil, mode: 0, **options)
tmpfile = nil
Dir::Tmpname.create(basename, tmpdir, options) do |tmpname, n, opts|
mode |= File::RDWR|File::CREAT|File::EXCL
test/test_tempfile.rb
end
end
def test_create_default_basename
path = nil
Tempfile.create {|f|
path = f.path
assert(File.exist?(path))
}
assert(!File.exist?(path))
end
def test_create_with_block
path = nil
Tempfile.create("tempfile-create") {|f|
    (1-1/1)