class TTY::Prompt::Reader::WinConsole
Constants
- ESC
- EXT_HEX
- NUL_HEX
Attributes
escape_codes[R]
Public Class Methods
new(input)
click to toggle source
# File lib/tty/prompt/reader/win_console.rb, line 27 def initialize(input) require_relative 'win_api' @input = input @keys = Codes.win_keys @escape_codes = [[NUL_HEX.ord], [ESC.ord], EXT_HEX.bytes.to_a] end
Public Instance Methods
get_char(options)
click to toggle source
Get a character from console with echo
@param [Hash] options @option options [Symbol] :echo
the echo toggle
@return [String]
@api private
# File lib/tty/prompt/reader/win_console.rb, line 43 def get_char(options) if options[:raw] WinAPI.getch.chr else options[:echo] ? @input.getc : WinAPI.getch.chr end end