Class: HighLine::Terminal::IOConsole
- Inherits:
-
HighLine::Terminal
- Object
- HighLine::Terminal
- HighLine::Terminal::IOConsole
- Defined in:
- lib/highline/terminal/io_console.rb
Overview
io/console option for HighLine::Terminal. It’s the most used terminal. TODO: We’re rescuing when not a terminal.
We should make a more robust implementation.
Instance Attribute Summary
Attributes inherited from HighLine::Terminal
Instance Method Summary collapse
-
#get_character ⇒ String
Get one character from the terminal.
-
#raw_no_echo_mode ⇒ Object
Enter Raw No Echo mode.
-
#restore_mode ⇒ Object
Restore terminal to its default mode.
-
#terminal_size ⇒ Array<Integer, Integer>
Two value terminal size like [columns, lines].
Methods inherited from HighLine::Terminal
#character_mode, #get_line, #get_line_default, #get_line_with_readline, get_terminal, #initialize, #initialize_system_extensions, #jruby?, #raw_no_echo_mode_exec, #readline_read, #rubinius?, #windows?
Constructor Details
This class inherits a constructor from HighLine::Terminal
Instance Method Details
#get_character ⇒ String
Get one character from the terminal
29 30 31 32 33 |
# File 'lib/highline/terminal/io_console.rb', line 29 def get_character input.getch(intr: true) # from ruby io/console rescue Errno::ENOTTY input.getc end |
#raw_no_echo_mode ⇒ Object
Enter Raw No Echo mode.
17 18 19 20 |
# File 'lib/highline/terminal/io_console.rb', line 17 def raw_no_echo_mode input.echo = false rescue Errno::ENOTTY end |
#restore_mode ⇒ Object
Restore terminal to its default mode
23 24 25 26 |
# File 'lib/highline/terminal/io_console.rb', line 23 def restore_mode input.echo = true rescue Errno::ENOTTY end |
#terminal_size ⇒ Array<Integer, Integer>
Returns two value terminal size like [columns, lines].
11 12 13 14 |
# File 'lib/highline/terminal/io_console.rb', line 11 def terminal_size output.winsize.reverse rescue Errno::ENOTTY end |