diff options
author | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-11-05 11:42:56 -0300 |
---|---|---|
committer | Abinoam P. Marques Jr <abinoam@gmail.com> | 2017-11-05 11:49:29 -0300 |
commit | 1fa3ce76dabc309948f6be709ef56cb66396b838 (patch) | |
tree | 389d00d0db2f962b9198cde988a3a45d5d10c644 | |
parent | 18c2eeb70714f06da79840b0b6c91c26f82adeee (diff) | |
download | highline-1fa3ce76dabc309948f6be709ef56cb66396b838.tar.gz |
Change rescue for a simple if/else
-rwxr-xr-x | lib/highline/question.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/highline/question.rb b/lib/highline/question.rb index f5d70bf..27b18b4 100755 --- a/lib/highline/question.rb +++ b/lib/highline/question.rb @@ -291,7 +291,11 @@ class HighLine def final_response(error) response = final_responses[error] - response.call(answer) rescue response + if response.respond_to?(:call) + response.call(answer) + else + response + end end # |