lib/tty/reader.rb
# Read a keypress including invisible multibyte codes and return
# a character as a string.
# Nothing is echoed to the console. This call will block for a
# single keypress, but will not wait for Enter to be pressed.
#
# @param [Boolean] echo
#   whether to echo chars back or not, defaults to false
# @option [Boolean] raw
#   whenther raw mode is enabled, defaults to true
# @option [Boolean] nonblock
#   whether to wait for input or not, defaults to false
#
# @return [String]
#
# @api public
Read a keypress including invisible multibyte codes and return
a character as a string.
Nothing is echoed to the console. This call will block for a
single keypress, but will not wait for Enter to be pressed.
Read a keypress including invisible multibyte codes and return a character as a string . Nothing is echoed to the console . This call will block for a single keypress but will not wait for Enter to be pressed .
def read_keypress(echo: false, raw: true, nonblock: false)
      codes = unbufferred do
        get_codes(echo: echo, raw: raw, nonblock: nonblock)
      end
      char = codes ? codes.pack("U*") : nil
      trigger_key_event(char) if char
      char
    end
def read_keypress ( echo : false , raw : true , nonblock : false ) codes = unbufferred do get_codes ( echo : echo , raw : raw , nonblock : nonblock ) end char = codes ? codes . pack ( "U*" ) : nil trigger_key_event ( char ) if char char end
Read a keypress including invisible multibyte codes and return
a character as a string.
Read a keypress including invisible multibyte codes and return a character as a string .
None
String
echo
raw
nonblock
nonblock whether to wait for input or not, defaults to false
nonblock whether to wait for input or not defaults to false
false
api
None