Methods

Class Index [+]

Quicksearch

Net::SSH::PromptMethods::Termios

Defines the prompt method to use if the Termios library is installed.

Public Instance Methods

prompt(prompt, echo=true) click to toggle source

Displays the prompt to $stdout. If echo is false, the Termios library will be used to disable keystroke echoing for the duration of this method.

    # File lib/net/ssh/prompt.rb, line 27
27:       def prompt(prompt, echo=true)
28:         $stdout.print(prompt)
29:         $stdout.flush
30: 
31:         set_echo(false) unless echo
32:         $stdin.gets.chomp
33:       ensure
34:         if !echo
35:           set_echo(true)
36:           $stdout.puts
37:         end
38:       end

Private Instance Methods

set_echo(enable) click to toggle source

Enables or disables keystroke echoing using the Termios library.

    # File lib/net/ssh/prompt.rb, line 43
43:         def set_echo(enable)
44:           term = ::Termios.getattr($stdin)
45: 
46:           if enable
47:             term.c_lflag |= (::Termios::ECHO | ::Termios::ICANON)
48:           else
49:             term.c_lflag &= ~::Termios::ECHO
50:           end
51: 
52:           ::Termios.setattr($stdin, ::Termios::TCSANOW, term)
53:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.