Class: HighlineWrapper::MultipleChoiceQuestion
- Defined in:
- lib/highline_wrapper/multiple_choice_question.rb
Class Method Summary collapse
Methods inherited from Question
ask_highline, format_options, format_selection, recurse, return_empty_defaults
Class Method Details
.ask(prompt, choices, options) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/highline_wrapper/multiple_choice_question.rb', line 8 def ask(prompt, choices, ) index = ask_highline((prompt, choices)).to_i - 1 return format_selection(choices, index, [:with_index]) unless index == -1 return recurse(prompt, choices, ) if [:required] return return_empty_defaults() if [:default].nil? return_defaults(choices, ) end |