Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO#isatty

isatty → true or false

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

IO#tty? is an alias for IO#isatty.

See also #ioflush #lineno #ioctl #lineno= also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0