End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#read
pathname.read([length [, offset]]) → string
pathname.read([length [, offset]], open_args) → string
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_read(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_read, 1+n, args, RB_PASS_CALLED_KEYWORDS);
}
Returns all data from the file, or the first N bytes if specified.
See File.read.