| Class | Net::SSH::Util::Prompter |
| In: |
lib/net/ssh/util/prompter.rb
|
| Parent: | Object |
A simple class for prompting a user for input.
Displays the prompt and then waits for the user to enter a response. If the ‘termios’ library is available, the user’s input will not be echoed to the terminal. The user’s response will be returned, with any trailing newline chomped.
# File lib/net/ssh/util/prompter.rb, line 37
37: def password( prompt=nil )
38: if $stdin.tty?
39: echo false
40: print prompt if prompt
41: end
42:
43: $stdin.gets.chomp
44: ensure
45: if $stdin.tty?
46: echo true
47: puts
48: end
49: end