Method: TTY::Reader#get_codes
- Defined in:
- lib/tty/reader.rb
#get_codes(echo: true, raw: false, nonblock: false, codes: []) ⇒ Array[Integer]
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get input code points
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 |
# File 'lib/tty/reader.rb', line 209 def get_codes(echo: true, raw: false, nonblock: false, codes: []) char = console.get_char(echo: echo, raw: raw, nonblock: nonblock) handle_interrupt if console.keys[char] == :ctrl_c return if char.nil? codes << char.ord condition = proc { |escape| (codes - escape).empty? || (escape - codes).empty? && !(64..126).cover?(codes.last) } while console.escape_codes.any?(&condition) char_codes = get_codes(echo: echo, raw: raw, nonblock: true, codes: codes) break if char_codes.nil? end codes end |