examples/select.rb in tty-prompt-0.18.0 vs examples/select.rb in tty-prompt-0.18.1

- old
+ new

@@ -2,18 +2,22 @@ require_relative "../lib/tty-prompt" prompt = TTY::Prompt.new -warriors = %w(Scorpion Kano Jax Kitana Raiden) +warriors = %i(Scorpion Kano Jax Kitana Raiden) prompt.on(:keypress) do |event| if event.value == 'j' prompt.trigger(:keydown) end if event.value == 'k' prompt.trigger(:keyup) end +end + +prompt.on(:keyescape) do |event| + exit(1) end answer = prompt.select('Choose your destiny?', warriors) puts answer.inspect