End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#unlink
unlink
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_unlink(VALUE self)
{
VALUE eENOTDIR = rb_const_get_at(rb_mErrno, id_ENOTDIR);
VALUE str = get_strpath(self);
return rb_rescue2(unlink_body, str, unlink_rescue, str, eENOTDIR, (VALUE)0);
}
Removes a file or directory, using File.unlink if self is a file, or Dir.unlink as necessary.