Method: Dir#inspect

Defined in:
dir.c

#inspectString

Returns a string description of self:

Dir.new('example').inspect # => "#<Dir:example>"

Returns:



734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
# File 'dir.c', line 734

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

    TypedData_Get_Struct(dir, struct dir_data, &dir_data_type, dirp);
    if (!NIL_P(dirp->path)) {
        VALUE str = rb_str_new_cstr("#<");
        rb_str_append(str, rb_class_name(CLASS_OF(dir)));
        rb_str_cat2(str, ":");
        rb_str_append(str, dirp->path);
        rb_str_cat2(str, ">");
        return str;
    }
    return rb_funcallv(dir, idTo_s, 0, 0);
}