Method: Dir#to_path

Defined in:
dir.c

#pathString?

Returns the dirpath string that was used to create self (or nil if created by method Dir.for_fd):

Dir.new('example').path # => "example"

Returns:



805
806
807
808
809
810
811
812
813
# File 'dir.c', line 805

static VALUE
dir_path(VALUE dir)
{
    struct dir_data *dirp;

    TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
    if (NIL_P(dirp->path)) return Qnil;
    return rb_str_dup(dirp->path);
}