[ruby/tempfile] File.new(fileno, mode: mode, path: path) is provided from Ruby 3.2
https://github.com/ruby/tempfile/commit/67ce897727
This commit is contained in:
parent
52082d19e0
commit
7812732e2c
@ -556,7 +556,7 @@ end
|
|||||||
# Related: Tempfile.new.
|
# Related: Tempfile.new.
|
||||||
#
|
#
|
||||||
def Tempfile.create(basename="", tmpdir=nil, mode: 0, anonymous: false, **options, &block)
|
def Tempfile.create(basename="", tmpdir=nil, mode: 0, anonymous: false, **options, &block)
|
||||||
if anonymous
|
if anonymous && RUBY_VERSION >= '3.2'
|
||||||
create_anonymous(basename, tmpdir, mode: mode, **options, &block)
|
create_anonymous(basename, tmpdir, mode: mode, **options, &block)
|
||||||
else
|
else
|
||||||
create_with_filename(basename, tmpdir, mode: mode, **options, &block)
|
create_with_filename(basename, tmpdir, mode: mode, **options, &block)
|
||||||
|
@ -488,7 +488,11 @@ puts Tempfile.new('foo').path
|
|||||||
Dir.mktmpdir {|d|
|
Dir.mktmpdir {|d|
|
||||||
t = Tempfile.create("", d, anonymous: true)
|
t = Tempfile.create("", d, anonymous: true)
|
||||||
t.close
|
t.close
|
||||||
assert_equal([], Dir.children(d))
|
if RUBY_VERSION >= '3.2'
|
||||||
|
assert_equal([], Dir.children(d))
|
||||||
|
else
|
||||||
|
refute_equal([], Dir.children(d))
|
||||||
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -496,7 +500,11 @@ puts Tempfile.new('foo').path
|
|||||||
Dir.mktmpdir {|d|
|
Dir.mktmpdir {|d|
|
||||||
begin
|
begin
|
||||||
t = Tempfile.create("", d, anonymous: true)
|
t = Tempfile.create("", d, anonymous: true)
|
||||||
assert_equal(File.join(d, ""), t.path)
|
if RUBY_VERSION >= '3.2'
|
||||||
|
assert_equal(File.join(d, ""), t.path)
|
||||||
|
else
|
||||||
|
refute_equal(File.join(d, ""), t.path)
|
||||||
|
end
|
||||||
ensure
|
ensure
|
||||||
t.close if t
|
t.close if t
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user