summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/highline/question_asker.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/highline/question_asker.rb b/lib/highline/question_asker.rb
index 0d124b1..4c1ff5b 100644
--- a/lib/highline/question_asker.rb
+++ b/lib/highline/question_asker.rb
@@ -66,10 +66,10 @@ class HighLine
def gather_answers
original_question_template = question.template
verify_match = question.verify_match
+ answers = []
- begin # when verify_match is set this loop will repeat until unique_answers == 1
+ loop do # when verify_match is set this loop will repeat until unique_answers == 1
question.template = original_question_template
-
answers = gather_answers_based_on_type
if verify_match && (@highline.send(:unique_answers, answers).size > 1)
@@ -77,7 +77,8 @@ class HighLine
else
verify_match = false
end
- end while verify_match
+ break unless verify_match
+ end
question.verify_match ? @highline.send(:last_answer, answers) : answers
end