diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-05-31 01:11:40 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-05-31 01:11:40 -0300 |
commit | 1709704ecd0ed2e96061ea151bb9e20c2ebb504e (patch) | |
tree | e51962ac9c21d8bd4c881931cab3cef209a3a156 | |
parent | 99febf851a2fff19a8871e6bbd9d3d9fd95e1c67 (diff) | |
download | highline-1709704ecd0ed2e96061ea151bb9e20c2ebb504e.tar.gz |
Simplify conditionals raising earlier
-rwxr-xr-x | lib/highline.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index be43fd5..7f2b164 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -535,15 +535,13 @@ class HighLine question.convert - if question.in_range? - if question.confirm - # need to add a layer of scope (new_scope) to ask a question inside a - # question, without destroying instance data + raise NotInRangeQuestionError unless question.in_range? - raise NoConfirmationQuestionError unless new_scope.agree(question.confirm_question(self)) - end - else - raise NotInRangeQuestionError + if question.confirm + # need to add a layer of scope (new_scope) to ask a question inside a + # question, without destroying instance data + + raise NoConfirmationQuestionError unless new_scope.agree(question.confirm_question(self)) end rescue NoConfirmationQuestionError |