Class: Dizby::LocalTunnelStrategy

Inherits:
Object
  • Object
show all
Includes:
TunnelableLocal
Defined in:
lib/dizby/tunnel/local_strategy.rb

Instance Method Summary collapse

Methods included from TunnelableLocal

#create_local_tunnel

Constructor Details

#initialize(server_port) ⇒ LocalTunnelStrategy

Returns a new instance of LocalTunnelStrategy.


10
11
12
# File 'lib/dizby/tunnel/local_strategy.rb', line 10

def initialize(server_port)
  @server_port = server_port
end

Instance Method Details

#read(stream)


20
21
22
23
24
# File 'lib/dizby/tunnel/local_strategy.rb', line 20

def read(stream)
  local_tunnel = stream.gets.chomp.to_i

  [local_tunnel, nil]
end

#write(ssh, stream)


14
15
16
17
18
# File 'lib/dizby/tunnel/local_strategy.rb', line 14

def write(ssh, stream)
  local_tunnel = create_local_tunnel(ssh, @server_port)

  stream.puts local_tunnel
end