Class: Dkdeploy::InteractionHandler::Password
- Inherits:
-
Object
- Object
- Dkdeploy::InteractionHandler::Password
- Defined in:
- lib/dkdeploy/interaction_handler/password.rb
Overview
Interaction handler for password
Instance Method Summary collapse
-
#initialize(password) ⇒ Password
constructor
Interaction handler for password.
-
#on_data(_command, _stream_name, data, channel) ⇒ Object
Method to send password to terminal.
Constructor Details
#initialize(password) ⇒ Password
Interaction handler for password
10 11 12 |
# File 'lib/dkdeploy/interaction_handler/password.rb', line 10 def initialize(password) @password = password end |
Instance Method Details
#on_data(_command, _stream_name, data, channel) ⇒ Object
Method to send password to terminal
20 21 22 23 24 25 26 27 |
# File 'lib/dkdeploy/interaction_handler/password.rb', line 20 def on_data(_command, _stream_name, data, channel) if data =~ /.*password.*/i channel.send_data("#{@password}\n") else channel.close raise 'Unexpected data from stream. Can not send password to undefined stream.' end end |