-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
jruby 9.4.3.0 (3.1.4) 2023-06-07 3086960 OpenJDK 64-Bit Server VM 14.0.2+12-46 on 14.0.2+12-46 +jit [x86_64-darwin]
I've got some code where I've subclassed File and altered the constructor. The call to .new works as expected. However, a call to open results in an error with JRuby. It works as expected with MRI. The following code demonstrates the problem:
class File::Temp < File
def initialize(delete: true, **options)
path = File.join(Dir.pwd, 'rb_file_temp_XXXXXX')
options[:mode] ||= 'wb+'
super(path, **options)
end
end
# This works
fh = File::Temp.new(:delete => false)
fh.puts "hello"
fh.close
# This doesn't -> ArgumentError: wrong number of arguments (given 1, expected 0)
File::Temp.open(:delete => false){ |fh| fh.puts "world" }Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels