Skip to content

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

class method

IO.console

IO.console → #<File:/dev/tty>
IO.console(sym, *args)

Returns an File instance opened console.

If sym is given, it will be sent to the opened console with args and the result will be returned instead of the console IO itself.

You must require ‘io/console’ to use this method.

See also .binwrite .console_size .binread .copy_stream also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1