Class: Knj::SSHRobot::Forward
Instance Attribute Summary collapse
-
#open ⇒ Object
readonly
Returns the value of attribute open.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(args) ⇒ Forward
constructor
A new instance of Forward.
Constructor Details
#initialize(args) ⇒ Forward
Returns a new instance of Forward.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 80 def initialize(args) @open = true @args = args @thread = Knj::Thread.new do begin #args[:session].logger.sev_threshold = Logger::Severity::DEBUG if args[:type] == "local" @args[:session].forward.local(@args[:host_local], @args[:port_local].to_i, @args[:host], @args[:port_remote].to_i) elsif args[:type] == "remote" @args[:session].forward.remote_to(@args[:port_local], @args[:host], @args[:port_remote], @args[:host_local]) else raise "No valid type given." end @args[:session].loop do true end rescue Exception => e puts e.inspect puts e.backtrace @open = false end end end |
Instance Attribute Details
#open ⇒ Object (readonly)
Returns the value of attribute open.
78 79 80 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 78 def open @open end |
Instance Method Details
#close ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/knj/sshrobot/sshrobot.rb', line 106 def close if !@args return nil end @args[:session].close @open = false @thread.exit @args = nil @thread = nil end |