Method: HighLine::Question.build

Defined in:
lib/highline/question.rb

.build(template_or_question, answer_type = nil, &details) ⇒ Question

If template_or_question is already a Question object just return it. If not, build it.

Parameters:

  • template_or_question (String, Question)

    what to ask

  • answer_type (Class) (defaults to: nil)

    to what class to convert the answer

  • details

    to be passed to Question.new

Returns:



35
36
37
38
39
40
41
# File 'lib/highline/question.rb', line 35

def self.build(template_or_question, answer_type = nil, &details)
  if template_or_question.is_a? Question
    template_or_question
  else
    Question.new(template_or_question, answer_type, &details)
  end
end