Class: DebuggerXml::Ide::ControlCommandProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/debugger_xml/ide/control_command_processor.rb

Direct Known Subclasses

Vim::ControlCommandProcessor

Instance Method Summary collapse

Constructor Details

#initialize(interface, proxy) ⇒ ControlCommandProcessor

Returns a new instance of ControlCommandProcessor.



5
6
7
8
# File 'lib/debugger_xml/ide/control_command_processor.rb', line 5

def initialize(interface, proxy)
  @interface = interface
  @proxy = proxy
end

Instance Method Details

#process_command(cmd) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/debugger_xml/ide/control_command_processor.rb', line 22

def process_command(cmd)
  catch(:debug_error) do
    if matched_cmd = @proxy.control_commands(@interface).find { |c| c.match(cmd) }
      matched_cmd.execute
    else
      process_context_commands(cmd)
    end
  end
end

#process_commandsObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/debugger_xml/ide/control_command_processor.rb', line 10

def process_commands
  while input = @interface.read_command
    process_input(input)
  end
rescue IOError, Errno::EPIPE
rescue Exception
  @interface.print("INTERNAL ERROR!!! #{$!}\n") rescue nil
  @interface.print($!.backtrace.map { |l| "\t#{l}" }.join("\n")) rescue nil
ensure
  @interface.close
end