Method: HighLine#ask
- Defined in:
- lib/highline.rb
#ask(template_or_question, answer_type = nil, &details) ⇒ Object
This method is the primary interface for user input. Just provide a question to ask the user, the answer_type you want returned, and optionally a code block setting up details of how you want the question handled. See #say for details on the format of question, and Question for more information about answer_type and what’s valid in the code block.
Raises EOFError if input is exhausted.
217 218 219 220 221 222 223 224 225 |
# File 'lib/highline.rb', line 217 def ask(template_or_question, answer_type = nil, &details) question = Question.build(template_or_question, answer_type, &details) if question.gather QuestionAsker.new(question, self).gather_answers else QuestionAsker.new(question, self).ask_once end end |