Class: HighLine::Terminal::IOConsole

Inherits:
HighLine::Terminal show all
Defined in:
lib/highline/terminal/io_console.rb

Overview

io/console option for HighLine::Terminal. It's the most used terminal.

Instance Attribute Summary

Attributes inherited from HighLine::Terminal

#input, #output

Instance Method Summary collapse

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_characterString

Get one character from the terminal

Returns:


24
25
26
# File 'lib/highline/terminal/io_console.rb', line 24

def get_character # rubocop:disable Naming/AccessorMethodName
  input.getch # from ruby io/console
end

#raw_no_echo_modeObject

Enter Raw No Echo mode.


14
15
16
# File 'lib/highline/terminal/io_console.rb', line 14

def raw_no_echo_mode
  input.echo = false
end

#restore_modeObject

Restore terminal to its default mode


19
20
21
# File 'lib/highline/terminal/io_console.rb', line 19

def restore_mode
  input.echo = true
end

#terminal_sizeArray<Integer, Integer>

Returns two value terminal size like [columns, lines].

Returns:

  • (Array<Integer, Integer>)

    two value terminal size like [columns, lines]


9
10
11
# File 'lib/highline/terminal/io_console.rb', line 9

def terminal_size
  output.winsize.reverse
end