class Net::SSH::Prompt::Prompter
default prompt object implementation. More sophisticated implemenetations might implement caching.
Public Class Methods
new(info)
click to toggle source
# 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
Public Instance Methods
ask(prompt, echo = true)
click to toggle source
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()
click to toggle source
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