instance method
IO#isatty
() -> bool
isatty → true or false
io.c
View on GitHub ↗
static VALUE
rb_io_isatty(VALUE io)
{
rb_io_t *fptr;
GetOpenFile(io, fptr);
return RBOOL(isatty(fptr->fd) != 0);
}
Returns true if the stream is associated with a terminal device (tty), false otherwise:
Example
f = File.new('t.txt').isatty #=> false f.close f = File.new('/dev/tty').isatty #=> true f.close