Class: SSHConnection
- Inherits:
-
Object
- Object
- SSHConnection
- Defined in:
- lib/ssh_connection.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
-
#initialize(config) ⇒ SSHConnection
constructor
A new instance of SSHConnection.
- #send_command(commandstr) ⇒ Object
Constructor Details
#initialize(config) ⇒ SSHConnection
Returns a new instance of SSHConnection.
4 5 6 |
# File 'lib/ssh_connection.rb', line 4 def initialize(config) @connection = Net::SSH.start(config[:host], config[:username], :password => config[:password]) end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
2 3 4 |
# File 'lib/ssh_connection.rb', line 2 def debug @debug end |
Instance Method Details
#send_command(commandstr) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ssh_connection.rb', line 8 def send_command(commandstr) if !@debug @connection.exec! commandstr else puts "command: #{commandstr}" end end |