Module | Interactive |
In: |
lib/interact/interactive.rb
|
Copyright (c) 2012 Alex Suraci
EVENTS | = | { "\b" => :backspace, "\t" => :tab, "\x01" => :home, "\x03" => :interrupt, "\x04" => :eof, "\x05" => :end, "\x17" => :kill_word, "\x7f" => :backspace, "\r" => :enter, "\n" => :enter |
ESCAPES | = | { "[A" => :up, "H" => :up, "[B" => :down, "P" => :down, "[C" => :right, "M" => :right, "[D" => :left, "K" => :left, "[3~" => :delete, "S" => :delete, "[H" => :home, "G" => :home, "[F" => :end, "O" => :end |
Ask a question and get an answer.
See Interact#read_line for the other possible values in options.
default: | The default value, also used to attempt type conversion of the answer (e.g. numeric/boolean). |
choices: | An array (or Enumerable) of strings to choose from. |
indexed: | Use alternative choice listing, and allow choosing by number. Good for when there are many choices or choices with long names. |
Read a single character.
input: | The input source (defaults to $stdin). |
Read a single event.
input: | The input source (defaults to $stdin). |