Class: Byebug::Remote::Client
- Inherits:
-
Object
- Object
- Byebug::Remote::Client
- Defined in:
- lib/byebug/remote/client.rb
Overview
Client for remote debugging
Instance Attribute Summary collapse
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
-
#initialize(interface) ⇒ Client
constructor
A new instance of Client.
-
#start(host = "localhost", port = PORT) ⇒ Object
Connects to the remote byebug.
- #started? ⇒ Boolean
Constructor Details
#initialize(interface) ⇒ Client
Returns a new instance of Client.
13 14 15 16 |
# File 'lib/byebug/remote/client.rb', line 13 def initialize(interface) @interface = interface @socket = nil end |
Instance Attribute Details
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
11 12 13 |
# File 'lib/byebug/remote/client.rb', line 11 def interface @interface end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
11 12 13 |
# File 'lib/byebug/remote/client.rb', line 11 def socket @socket end |
Instance Method Details
#start(host = "localhost", port = PORT) ⇒ Object
Connects to the remote byebug
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/byebug/remote/client.rb', line 21 def start(host = "localhost", port = PORT) connect_at(host, port) while (line = socket.gets) case line when /^PROMPT (.*)$/ input = interface.read_command(Regexp.last_match[1]) break unless input socket.puts input when /^CONFIRM (.*)$/ input = interface.readline(Regexp.last_match[1]) break unless input socket.puts input else interface.puts line end end socket.close end |
#started? ⇒ Boolean
44 45 46 |
# File 'lib/byebug/remote/client.rb', line 44 def started? !socket.nil? end |