method
inspect
v1_8_7_330 -
Show latest stable
- Class:
IO
inspect()public
Return a string describing this IO object.
/*
* call-seq:
* ios.inspect => string
*
* Return a string describing this IO object.
*/
static VALUE
rb_io_inspect(obj)
VALUE obj;
{
rb_io_t *fptr;
char *buf;
const char *cname, *st = "";
long len;
fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr || !fptr->path) return rb_any_to_s(obj);
cname = rb_obj_classname(obj);
len = strlen(cname) + strlen(fptr->path) + 5;
if (!(fptr->f || fptr->f2)) {
st = " (closed)";
len += 9;
}
buf = ALLOCA_N(char, len);
snprintf(buf, len, "#<%s:%s%s>", cname, fptr->path, st);
return rb_str_new2(buf);
} Related methods
- Instance methods
- <<
- binmode
- bytes
- chars
- close
- close_read
- close_write
- closed?
- each
- each_byte
- each_char
- each_line
- eof
- eof?
- fcntl
- fileno
- flush
- fsync
- getbyte
- getc
- gets
- initialize_copy
- inspect
- ioctl
- isatty
- lineno
- lineno=
- lines
- pid
- pos
- pos=
- printf
- putc
- puts
- read
- read_nonblock
- readbyte
- readbytes
- readchar
- readline
- readlines
- readpartial
- reopen
- rewind
- scanf
- seek
- stat
- sync
- sync=
- sysread
- sysseek
- syswrite
- tell
- to_i
- to_io
- tty?
- ungetc
- write
- write_nonblock
- Class methods
- for_fd
- foreach
- new
- new
- open
- pipe
- popen
- read
- readlines
- select
- sysopen
- Private methods
-
block_scanf -
soak_up_spaces