method
inspect
v1_9_3_125 -
Show latest stable
- Class:
IO
inspect()public
Return a string describing this IO object.
static VALUE
rb_io_inspect(VALUE obj)
{
rb_io_t *fptr;
const char *cname;
char fd_desc[4+sizeof(int)*3];
const char *path;
const char *st = "";
fptr = RFILE(rb_io_taint_check(obj))->fptr;
if (!fptr) return rb_any_to_s(obj);
cname = rb_obj_classname(obj);
if (NIL_P(fptr->pathv)) {
if (fptr->fd < 0) {
path = "";
st = "(closed)";
}
else {
snprintf(fd_desc, sizeof(fd_desc), "fd %d", fptr->fd);
path = fd_desc;
}
}
else {
path = RSTRING_PTR(fptr->pathv);
if (fptr->fd < 0) {
st = " (closed)";
}
}
return rb_sprintf("#<%s:%s%s>", cname, path, st);
} Related methods
- Instance methods
- <<
- advise
- autoclose=
- autoclose?
- binmode
- binmode?
- bytes
- chars
- close
- close_on_exec=
- close_on_exec?
- close_read
- close_write
- closed?
- codepoints
- each
- each_byte
- each_char
- each_codepoint
- each_line
- echo=
- echo?
- eof
- eof?
- expect
- external_encoding
- fcntl
- fdatasync
- fileno
- flush
- fsync
- getbyte
- getc
- getch
- gets
- iflush
- initialize_copy
- inspect
- internal_encoding
- ioctl
- ioflush
- isatty
- lineno
- lineno=
- lines
- noecho
- nread
- oflush
- pid
- pos
- pos=
- printf
- putc
- puts
- raw
- raw!
- read
- read_nonblock
- readbyte
- readchar
- readline
- readlines
- readpartial
- ready?
- reopen
- rewind
- scanf
- seek
- set_encoding
- stat
- sync
- sync=
- sysread
- sysseek
- syswrite
- tell
- to_i
- to_io
- tty?
- ungetbyte
- ungetc
- wait
- winsize
- winsize=
- write
- write_nonblock
- Class methods
- binread
- binwrite
- console
- copy_stream
- for_fd
- foreach
- new
- open
- pipe
- popen
- read
- readlines
- select
- sysopen
- try_convert
- write
- Private methods
-
block_scanf -
soak_up_spaces