Class: Debugger::Xml::Ide::ControlCommandProcessor

Inherits:
Processor
  • 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) ⇒ ControlCommandProcessor

Returns a new instance of ControlCommandProcessor.



7
8
9
# File 'lib/debugger/xml/ide/control_command_processor.rb', line 7

def initialize(interface)
  @interface = interface
end

Instance Method Details

#process_command(cmd) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/debugger/xml/ide/control_command_processor.rb', line 23

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

#process_commandsObject



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

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