Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

IO#tty?

tty?

Alias of #isatty

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
See also #isatty #to_path #ungetbyte #to_io also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0