method

isatty

v1_8_7_330 - Show latest stable - Class: IO
isatty()
public

Returns true if ios is associated with a terminal device (tty), false otherwise.

File.new("testfile").isatty   #=> false
File.new("/dev/tty").isatty   #=> true