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.


8
9
10
# File 'lib/dizby/tunnel/local_strategy.rb', line 8

def initialize(server_port)
  @server_port = server_port
end

Instance Method Details

#read(stream)


18
19
20
21
22
# File 'lib/dizby/tunnel/local_strategy.rb', line 18

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

  [local_tunnel, nil]
end

#write(ssh, stream)


12
13
14
15
16
# File 'lib/dizby/tunnel/local_strategy.rb', line 12

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

  stream.puts local_tunnel
end