Class: Bcome::Ssh::Tunnel::LocalPortForward
- Inherits:
-
Object
- Object
- Bcome::Ssh::Tunnel::LocalPortForward
- Defined in:
- lib/objects/ssh/tunnel/local_port_forward.rb
Instance Method Summary collapse
- #close! ⇒ Object
-
#initialize(tunnel_command) ⇒ LocalPortForward
constructor
A new instance of LocalPortForward.
- #open! ⇒ Object
Constructor Details
#initialize(tunnel_command) ⇒ LocalPortForward
Returns a new instance of LocalPortForward.
5 6 7 8 |
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 5 def initialize(tunnel_command) @tunnel_command = tunnel_command @process_pid = nil end |
Instance Method Details
#close! ⇒ Object
14 15 16 17 |
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 14 def close! puts "Closing tunnel:\s".informational + @tunnel_command.to_s.terminal_prompt ::Process.kill('HUP', @process_pid) end |
#open! ⇒ Object
10 11 12 |
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 10 def open! @process_pid = spawn(@tunnel_command) end |