Module: PryRemoteEm::Client::Proxy

Defined in:
lib/pry-remote-em/client/proxy.rb

Instance Method Summary collapse

Instance Method Details

#connection_completedObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/pry-remote-em/client/proxy.rb', line 11

def connection_completed
  if get_peername
    port, ip = Socket.unpack_sockaddr_in(get_peername)
    log.info("[pry-remote-em] proxy connected to pryem://#{ip}:#{port}/")
  else
    log.info("[pry-remote-em] proxy connected")
  end
  @client.proxy_incoming_to(self)
  proxy_incoming_to(@client)
end

#initialize(client, opts = {}) ⇒ Object



6
7
8
9
# File 'lib/pry-remote-em/client/proxy.rb', line 6

def initialize(client, opts = {})
  @opts   = opts
  @client = client
end

#logObject



22
23
24
25
# File 'lib/pry-remote-em/client/proxy.rb', line 22

def log
  return @opts[:logger] if @opts[:logger]
  @log ||= Logger.new(STDERR)
end

#unbindObject



27
28
29
# File 'lib/pry-remote-em/client/proxy.rb', line 27

def unbind
  @client && @client.close_connection(true)
end