summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 01:24:27 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 01:24:27 -0300
commit1b2babce21c1dc16331c890c8a6c6e2550d0759b (patch)
treee9784c0ffa1320c6d76eff91d7be46a1498c456e
parent92872eaf3e200df50fac5fe5e8ce1c8b2d1373aa (diff)
downloadhighline-1b2babce21c1dc16331c890c8a6c6e2550d0759b.tar.gz
Use loop do over begin/end/while
-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