default prompt object implementation. More sophisticated implemenetations might implement caching.
# File lib/net/ssh/prompt.rb, line 32 def initialize(info) if info[:type] == 'keyboard-interactive' $stdout.puts(info[:name]) unless info[:name].empty? $stdout.puts(info[:instruction]) unless info[:instruction].empty? end end
ask input from user, a prompter might ask for multiple inputs (like user and password) in a single session.
# File lib/net/ssh/prompt.rb, line 41 def ask(prompt, echo=true) $stdout.print(prompt) $stdout.flush ret = $stdin.noecho(&:gets).chomp $stdout.print("\n") ret end
success method will be called when the password was accepted It's a good time to save password asked to a cache.
# File lib/net/ssh/prompt.rb, line 51 def success; end