summaryrefslogtreecommitdiff
path: root/lib/highline/question_asker.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/highline/question_asker.rb')
-rw-r--r--lib/highline/question_asker.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/highline/question_asker.rb b/lib/highline/question_asker.rb
index cb8dfa8..52f4959 100644
--- a/lib/highline/question_asker.rb
+++ b/lib/highline/question_asker.rb
@@ -115,10 +115,15 @@ class HighLine
## Delegate to Highline
def explain_error(error)
- @highline.say(question.final_responses[error]) if error
+ @highline.say(error_final_response(error)) if error
@highline.say(question.ask_on_error_msg)
end
+ def error_final_response(error)
+ final_response = question.final_responses[error]
+ final_response.call(question.answer) rescue final_response
+ end
+
def gather_with_array
[].tap do |answers|
answers << ask_once