We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dafabf9 commit 0ca31a6Copy full SHA for 0ca31a6
lib/tempfile.rb
@@ -191,6 +191,7 @@ def open
191
mode = @mode & ~(File::CREAT|File::EXCL)
192
__setobj__(File.open(__getobj__.path, mode, **@opts))
193
ObjectSpace.define_finalizer(self, Closer.new(__getobj__))
194
+ __getobj__
195
end
196
197
def _close # :nodoc:
test/test_tempfile.rb
@@ -378,6 +378,14 @@ def test_create_default_basename
378
assert_file.not_exist?(path)
379
380
381
+ def test_open
382
+ Tempfile.open {|f|
383
+ file = f.open
384
+ assert_kind_of File, file
385
+ assert_equal f.to_i, file.to_i
386
+ }
387
+ end
388
+
389
def test_open_traversal_dir
390
assert_mktmpdir_traversal do |traversal_path|
391
t = Tempfile.open([traversal_path, 'foo'])
0 commit comments