123456789_123456789_123456789_123456789_123456789_

Class: IO

Relationships & Source Files
Namespace Children
Modules:
Inherits: Object
Defined in: ext/io/console/console.c

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Class Method Details

.console ⇒ #<File:/dev/tty .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.

.default_console_size

fallback to console window size

[ GitHub ]

  
# File 'ext/io/console/lib/console/size.rb', line 3

def IO.default_console_size
  [
    ENV["LINES"].to_i.nonzero? || 25,
    ENV["COLUMNS"].to_i.nonzero? || 80,
  ]
end

Instance Attribute Details

#cursor (rw)

#cursor=(cpos) (rw)

#echo=(flag) (rw)

Enables/disables echo back. On some platforms, all combinations of this flags and raw/cooked mode may not be valid.

You must require 'io/console' to use this method.

#echo?Boolean (rw)

Returns true if echo back is enabled.

You must require 'io/console' to use this method.

#winsizeArray, columns (rw)

Returns console size.

You must require 'io/console' to use this method.

#winsize=([rows, columns]) (rw)

Tries to set console size. The effect depends on the platform and the running environment.

You must require 'io/console' to use this method.

Instance Method Details

#beep

#cooked {|io| ... }

Yields self within cooked mode.

STDIN.cooked(&:gets)

will read and return a line with echo back and line editing.

You must require 'io/console' to use this method.

#cooked!

Enables cooked mode.

If the terminal mode needs to be back, use io.cooked { … }.

You must require 'io/console' to use this method.

#getch(min: nil, time: nil) ⇒ String

Reads and returns a character in raw mode.

You must require 'io/console' to use this method.

#getpass(prompt = nil) ⇒ String

Reads and returns a line without echo back. Prints prompt unless it is nil.

You must require 'io/console' to use this method.

#goto(x, y)

#iflush

Flushes input buffer in kernel.

You must require 'io/console' to use this method.

#ioflush

Flushes input and output buffers in kernel.

You must require 'io/console' to use this method.

#noecho {|io| ... }

Yields self with disabling echo back.

STDIN.noecho(&:gets)

will read and return a line without echo back.

You must require 'io/console' to use this method.

#oflush

Flushes output buffer in kernel.

You must require 'io/console' to use this method.

#pressed?(k) ⇒ Boolean

#raw(min: nil, time: nil) {|io| ... }

Yields self within raw mode.

STDIN.raw(&:gets)

will read and return a line without echo back and line editing.

You must require 'io/console' to use this method.

#raw!(min: nil, time: nil)

Enables raw mode.

If the terminal mode needs to be back, use io.raw { … }.

You must require 'io/console' to use this method.