End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Dir#close
dir.close → nil
dir.c
View on GitHub ↗
static VALUE
dir_close(VALUE dir)
{
struct dir_data *dirp;
dirp = dir_get(dir);
if (!dirp->dir) return Qnil;
closedir(dirp->dir);
dirp->dir = NULL;
return Qnil;
}
Closes the directory stream. Calling this method on closed Dir object is ignored since Ruby 2.3.
Example
d = Dir.new("testdir") d.close #=> nil