summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-05-19 22:46:04 -0300
committerAbinoam Praxedes Marques Jr <abinoam@gmail.com>2015-05-20 00:03:23 -0300
commit3b78aeaa0e324ee0ea56cf6b923476fa5a42e830 (patch)
tree33232a1746d3c730d8082d4baa7b74378167695f
parent19de6eadc4687dfa0988a02c7b7537439f0e61c7 (diff)
downloadhighline-3b78aeaa0e324ee0ea56cf6b923476fa5a42e830.tar.gz
Extract Question#get_echo
-rwxr-xr-xlib/highline.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/highline.rb b/lib/highline.rb
index 860315a..f3dbade 100755
--- a/lib/highline.rb
+++ b/lib/highline.rb
@@ -763,13 +763,7 @@ class HighLine
@output.print("\r#{HighLine.Style(:erase_line).code}")
@output.flush
else
- echo = if question.echo == true
- response
- elsif question.echo != false
- question.echo
- else
- ""
- end
+ echo = get_echo(question, response)
say("#{echo}\n")
end
end
@@ -779,6 +773,16 @@ class HighLine
question.change_case(response)
end
+ def get_echo(question, response)
+ if question.echo == true
+ response
+ elsif question.echo != false
+ question.echo
+ else
+ ""
+ end
+ end
+
public :get_response_character_mode, :get_response_line_mode
def actual_length(text)