5

I need a way to remove the newline from the ask method included in highline. Here's my current code:

pass = ask( "Enter your password > " ) { |passman| passman.echo = false }

But whenever I run the that, the output is

Enter your password > 
(typing goes here)

and I wish for this to not have a newline character. Any suggestions?

Mark
  • 694
  • 5
  • 15
  • Something is wrong here. In your example - with a space at the end - HighLine should give a prompt without a line break. If you omit the space at the end, you would get the result you showed here. Somehow your question and the provided answer have it the other way around. – patrikf Oct 11 '13 at 08:48

1 Answers1

8

doc: highline says:

If the provided statement ends with a space or tab character, a newline will not be appended (output will be flush()ed).

So try it with a space:

pass = ask( "Enter your password > " ) { |passman| passman.echo = false }
patrikf
  • 917
  • 7
  • 10
sawa
  • 165,429
  • 45
  • 277
  • 381
  • Unfortunately, that did not work. Thank you for your assistance anyways! – Mark May 14 '11 at 21:28
  • It must have been a temporary glitch, for an hour later when I came back, it was working. Thank you very much, and I apologize for the previous mixup. – Mark May 14 '11 at 22:34
  • 1
    Something to note, if using colorize you will need to fudge the string a bit to stop highline printing a newline – Rob Oct 26 '11 at 15:01