summaryrefslogtreecommitdiff
path: root/lib/highline
diff options
context:
space:
mode:
authorAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 01:43:25 -0300
committerAbinoam P. Marques Jr <abinoam@gmail.com>2017-07-02 01:43:25 -0300
commite8dd37d9b7fd35f138ba62d1197598d8d207e75b (patch)
treec36e0a639997bb70344cdc8b68ff8b254446b1b1 /lib/highline
parentff7f130c3f17dcabfad26f5372e82c7c94a28d7b (diff)
downloadhighline-e8dd37d9b7fd35f138ba62d1197598d8d207e75b.tar.gz
Use a guard clause
Diffstat (limited to 'lib/highline')
-rw-r--r--lib/highline/question_asker.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/highline/question_asker.rb b/lib/highline/question_asker.rb
index 433d709..b919cb0 100644
--- a/lib/highline/question_asker.rb
+++ b/lib/highline/question_asker.rb
@@ -67,14 +67,14 @@ class HighLine
verify_match = question.verify_match
answers = []
- loop do # when verify_match is set this loop will repeat until unique_answers == 1
+ # when verify_match is set this loop will repeat until unique_answers == 1
+ loop do
answers = gather_answers_based_on_type
- if verify_match && (@highline.send(:unique_answers, answers).size > 1)
- explain_error(:mismatch)
- else
- break
- end
+ break unless verify_match &&
+ (@highline.send(:unique_answers, answers).size > 1)
+
+ explain_error(:mismatch)
end
verify_match ? @highline.send(:last_answer, answers) : answers