Class: Debugger::Xml::Ide::Interface
- Inherits:
-
Interface
- Object
- Interface
- Debugger::Xml::Ide::Interface
- Defined in:
- lib/debugger/xml/ide/interface.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#command_queue ⇒ Object
Returns the value of attribute command_queue.
-
#histfile ⇒ Object
Returns the value of attribute histfile.
-
#history_length ⇒ Object
Returns the value of attribute history_length.
-
#history_save ⇒ Object
Returns the value of attribute history_save.
-
#restart_file ⇒ Object
Returns the value of attribute restart_file.
Instance Method Summary collapse
- #close ⇒ Object
- #confirm(prompt) ⇒ Object
- #errmsg(*args) ⇒ Object
- #finalize ⇒ Object
-
#initialize(socket) ⇒ Interface
constructor
A new instance of Interface.
-
#non_blocking_gets ⇒ Object
Workaround for JRuby issue jira.codehaus.org/browse/JRUBY-2063.
- #print(*args) ⇒ Object
- #print_debug(msg) ⇒ Object
- #read_command(*args) ⇒ Object
- #readline_support? ⇒ Boolean
Constructor Details
#initialize(socket) ⇒ Interface
Returns a new instance of Interface.
11 12 13 14 15 16 17 18 |
# File 'lib/debugger/xml/ide/interface.rb', line 11 def initialize(socket) @command_queue = [] @socket = socket @history_save = false @history_length = 256 @histfile = '' @restart_file = nil end |
Instance Attribute Details
#command_queue ⇒ Object
Returns the value of attribute command_queue.
5 6 7 |
# File 'lib/debugger/xml/ide/interface.rb', line 5 def command_queue @command_queue end |
#histfile ⇒ Object
Returns the value of attribute histfile.
6 7 8 |
# File 'lib/debugger/xml/ide/interface.rb', line 6 def histfile @histfile end |
#history_length ⇒ Object
Returns the value of attribute history_length.
8 9 10 |
# File 'lib/debugger/xml/ide/interface.rb', line 8 def history_length @history_length end |
#history_save ⇒ Object
Returns the value of attribute history_save.
7 8 9 |
# File 'lib/debugger/xml/ide/interface.rb', line 7 def history_save @history_save end |
#restart_file ⇒ Object
Returns the value of attribute restart_file.
9 10 11 |
# File 'lib/debugger/xml/ide/interface.rb', line 9 def restart_file @restart_file end |
Instance Method Details
#close ⇒ Object
20 21 22 23 |
# File 'lib/debugger/xml/ide/interface.rb', line 20 def close @socket.close rescue Exception end |
#confirm(prompt) ⇒ Object
33 34 35 |
# File 'lib/debugger/xml/ide/interface.rb', line 33 def confirm(prompt) true end |
#errmsg(*args) ⇒ Object
29 30 31 |
# File 'lib/debugger/xml/ide/interface.rb', line 29 def errmsg(*args) print(*args) end |
#finalize ⇒ Object
37 38 39 |
# File 'lib/debugger/xml/ide/interface.rb', line 37 def finalize close end |
#non_blocking_gets ⇒ Object
Workaround for JRuby issue jira.codehaus.org/browse/JRUBY-2063
42 43 44 45 46 47 48 |
# File 'lib/debugger/xml/ide/interface.rb', line 42 def non_blocking_gets loop do result, _, _ = IO.select([@socket], nil, nil, 0.2) next unless result return result[0].gets end end |
#print(*args) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/debugger/xml/ide/interface.rb', line 62 def print(*args) escaped_args = escape_input(args) value = escaped_args.first % escaped_args[1..-1] Xml.logger.puts("Going to print: #{value}") @socket.print(value) end |
#print_debug(msg) ⇒ Object
25 26 27 |
# File 'lib/debugger/xml/ide/interface.rb', line 25 def print_debug(msg) STDOUT.puts(msg) end |
#read_command(*args) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/debugger/xml/ide/interface.rb', line 50 def read_command(*args) result = non_blocking_gets raise IOError unless result result.chomp.tap do |r| Xml.logger.puts("Read command: #{r}") end end |
#readline_support? ⇒ Boolean
58 59 60 |
# File 'lib/debugger/xml/ide/interface.rb', line 58 def readline_support? false end |