Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method

IO.console

() -> ::File?
(:close) -> nil
(::Symbol sym, *untyped args) -> untyped
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 .copy_stream .binread .foreach also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0