inspect()
public
Return a string describing this Dir object.
Show source
/*
* call-seq:
* dir.inspect => string
*
* Return a string describing this Dir object.
*/
static VALUE
dir_inspect(dir)
VALUE dir;
{
struct dir_data *dirp;
Data_Get_Struct(dir, struct dir_data, dirp);
if (dirp->path) {
const char *c = rb_obj_classname(dir);
int len = strlen(c) + strlen(dirp->path) + 4;
VALUE s = rb_str_new(0, len);
snprintf(RSTRING_PTR(s), len+1, "#<%s:%s>", c, dirp->path);
return s;
}
return rb_funcall(dir, rb_intern("to_s"), 0, 0);
}