End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#write
pathname.write(string, [offset] ) => fixnum
pathname.write(string, [offset], open_args ) => fixnum
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_write(int argc, VALUE *argv, VALUE self)
{
VALUE args[4];
int n;
args[0] = get_strpath(self);
n = rb_scan_args(argc, argv, "03", &args[1], &args[2], &args[3]);
return rb_funcallv_kw(rb_cFile, id_write, 1+n, args, RB_PASS_CALLED_KEYWORDS);
}
Writes contents to the file.
See File.write.