Class: Byebug::RemoteInterface

Inherits:
Interface show all
Defined in:
lib/byebug/interfaces/remote_interface.rb

Overview

Interface class for remote use of byebug.

Instance Attribute Summary

Attributes inherited from Interface

#command_queue, #error, #history, #input, #output

Instance Method Summary collapse

Methods inherited from Interface

#autorestore, #autosave, #errmsg, #last_if_empty, #prepare_input, #read_file, #read_input

Methods included from Helpers::FileHelper

#get_line, #get_lines, #n_lines, #normalize, #shortpath, #virtual_file?

Constructor Details

#initialize(socket) ⇒ RemoteInterface

Returns a new instance of RemoteInterface.



10
11
12
13
14
15
# File 'lib/byebug/interfaces/remote_interface.rb', line 10

def initialize(socket)
  super()
  @input = socket
  @output = socket
  @error = socket
end

Instance Method Details

#closeObject



41
42
43
# File 'lib/byebug/interfaces/remote_interface.rb', line 41

def close
  output.close
end

#confirm(prompt) ⇒ Object



23
24
25
26
27
# File 'lib/byebug/interfaces/remote_interface.rb', line 23

def confirm(prompt)
  super("CONFIRM #{prompt}")
rescue Errno::EPIPE, Errno::ECONNABORTED
  false
end


29
30
31
32
33
# File 'lib/byebug/interfaces/remote_interface.rb', line 29

def print(message)
  super(message)
rescue Errno::EPIPE, Errno::ECONNABORTED
  nil
end

#puts(message) ⇒ Object



35
36
37
38
39
# File 'lib/byebug/interfaces/remote_interface.rb', line 35

def puts(message)
  super(message)
rescue Errno::EPIPE, Errno::ECONNABORTED
  nil
end

#read_command(prompt) ⇒ Object



17
18
19
20
21
# File 'lib/byebug/interfaces/remote_interface.rb', line 17

def read_command(prompt)
  super("PROMPT #{prompt}")
rescue Errno::EPIPE, Errno::ECONNABORTED
  "continue"
end

#readline(prompt) ⇒ Object



45
46
47
48
# File 'lib/byebug/interfaces/remote_interface.rb', line 45

def readline(prompt)
  puts(prompt)
  (input.gets || "continue").chomp
end