diff options
author | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-05-19 22:46:04 -0300 |
---|---|---|
committer | Abinoam Praxedes Marques Jr <abinoam@gmail.com> | 2015-05-20 00:03:23 -0300 |
commit | 3b78aeaa0e324ee0ea56cf6b923476fa5a42e830 (patch) | |
tree | 33232a1746d3c730d8082d4baa7b74378167695f | |
parent | 19de6eadc4687dfa0988a02c7b7537439f0e61c7 (diff) | |
download | highline-3b78aeaa0e324ee0ea56cf6b923476fa5a42e830.tar.gz |
Extract Question#get_echo
-rwxr-xr-x | lib/highline.rb | 18 |
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) |