End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Dir#seek
dir.seek( integer ) → dir
dir.c
View on GitHub ↗
static VALUE
dir_seek(VALUE dir, VALUE pos)
{
struct dir_data *dirp;
long p = NUM2LONG(pos);
GetDIR(dir, dirp);
seekdir(dirp->dir, p);
return dir;
}
Seeks to a particular location in dir. integer must be a value returned by Dir#tell.
Example
d = Dir.new("testdir") #=> #<Dir:0x401b3c40> d.read #=> "." i = d.tell #=> 12 d.read #=> ".." d.seek(i) #=> #<Dir:0x401b3c40> d.read #=> ".."