diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-06-04 00:20:06 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-06-04 00:20:06 -0300 |
commit | 69b1357c143be77edf6a366a419fa052e5ddb79f (patch) | |
tree | 49ef61fb7c7e0a9d37b0b095d5bd4a65dbecc7b4 | |
parent | e6fc542a33cf1e0af7d6fff1a2ae653e808bb01e (diff) | |
download | highline-69b1357c143be77edf6a366a419fa052e5ddb79f.tar.gz |
Use case/when not if/elsif/else
-rwxr-xr-x | lib/highline.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/highline.rb b/lib/highline.rb index 9bc7855..fa71793 100755 --- a/lib/highline.rb +++ b/lib/highline.rb @@ -556,13 +556,14 @@ class HighLine retry rescue ArgumentError => error - if error.message =~ /ambiguous/ + case error.message + when /ambiguous/ # the assumption here is that OptionParser::Completion#complete # (used for ambiguity resolution) throws exceptions containing # the word 'ambiguous' whenever resolution fails explain_error(:ambiguous_completion, question) retry - elsif error.message =~ /invalid value for/ + when /invalid value for/ explain_error(:invalid_type, question) retry else |