instance method
Dir#seek
(::int pos) -> self
seek(position) → self
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;
}
Sets the position in self and returns self. The value of position should have been returned from an earlier call to tell; if not, the return values from subsequent calls to read are unspecified.
See Dir As Stream-Like.
Examples:
Example
dir = Dir.new('example') dir.pos # => 0 dir.seek(3) # => #<Dir:example> dir.pos # => 3 dir.seek(30) # => #<Dir:example> dir.pos # => 5