class TTY::Reader::Console
Constants
- CSI
- ESC
Attributes
escape_codes[R]
input[R]
mode[R]
Public Class Methods
new(input)
click to toggle source
# File lib/tty/reader/console.rb, line 26 def initialize(input) @input = input @mode = Mode.new(input) @keys = Keys.ctrl_keys.merge(Keys.keys) @escape_codes = [[ESC.ord], CSI.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/reader/console.rb, line 42 def get_char(options) mode.raw(options[:raw]) do mode.echo(options[:echo]) { input.getc } end end