summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlib/highline.rb4
-rwxr-xr-xlib/highline/question.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/highline.rb b/lib/highline.rb
index 784a93b..65845e1 100755
--- a/lib/highline.rb
+++ b/lib/highline.rb
@@ -530,10 +530,10 @@ class HighLine
say(question) unless ((question.readline) and (question.echo == true and question.limit.nil?))
begin
- question.answer = question.get_response_or_default(self)
+ question.get_response_or_default(self)
raise NotValidQuestionError unless question.valid_answer?
- question.answer = question.convert
+ question.convert
if question.in_range?
if question.confirm
diff --git a/lib/highline/question.rb b/lib/highline/question.rb
index 96f2df8..c03fb5c 100755
--- a/lib/highline/question.rb
+++ b/lib/highline/question.rb
@@ -312,8 +312,9 @@ class HighLine
# completed for any reason.
#
def convert
- return answer unless @answer_type
+ return unless @answer_type
+ self.answer =
if [::String, HighLine::String].include?(@answer_type)
HighLine::String(answer)
elsif [Float, Integer, String].include?(@answer_type)
@@ -486,7 +487,7 @@ class HighLine
end
def get_response_or_default(highline)
- answer_or_default(get_response(highline))
+ self.answer = answer_or_default(get_response(highline))
end
def ask_at(highline)