Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
File.open
File.open(path, mode = 'r', perm = 0666, **opts) → file
File.open(path, mode = 'r', perm = 0666, **opts) {|f| ... } → object
io.c
View on GitHub ↗
static VALUE
rb_io_s_open(int argc, VALUE *argv, VALUE klass)
{
VALUE io = rb_class_new_instance_kw(argc, argv, klass, RB_PASS_CALLED_KEYWORDS);
if (rb_block_given_p()) {
return rb_ensure(rb_yield, io, io_close, io);
}
return io;
}