End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Pathname#empty?
empty?
ext/pathname/pathname.c
View on GitHub ↗
static VALUE
path_empty_p(VALUE self)
{
VALUE path = get_strpath(self);
if (RTEST(rb_funcall(rb_mFileTest, id_directory_p, 1, path)))
return rb_funcall(rb_cDir, id_empty_p, 1, path);
else
return rb_funcall(rb_mFileTest, id_empty_p, 1, path);
}
Tests the file is empty.
See Dir#empty? and FileTest.empty?.