Class: Byebug::ScriptProcessor

Inherits:
CommandProcessor show all
Defined in:
lib/byebug/processors/script_processor.rb

Overview

Processes commands from a file

Instance Attribute Summary

Attributes inherited from CommandProcessor

#context, #prev_line

Instance Method Summary collapse

Methods inherited from CommandProcessor

#at_breakpoint, #at_catchpoint, #at_line, #at_return, #at_tracing, #command_list, #frame, #initialize, #interface, #printer, #proceed!

Methods included from Helpers::EvalHelper

#error_eval, #silent_eval, #single_thread_eval, #thread_safe_eval, #warning_eval

Constructor Details

This class inherits a constructor from Byebug::CommandProcessor

Instance Method Details

#commandsObject

Available commands



9
10
11
# File 'lib/byebug/processors/script_processor.rb', line 9

def commands
  super.select(&:allow_in_control)
end

#process_commandsObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/byebug/processors/script_processor.rb', line 13

def process_commands
  while (input = interface.read_command(prompt))
    command = command_list.match(input)

    if command
      command.new(self).execute
    else
      errmsg('Unknown command')
    end
  end

  interface.close
rescue IOError, SystemCallError
  interface.close
rescue
  without_exceptions do
    puts "INTERNAL ERROR!!! #{$ERROR_INFO}"
    puts $ERROR_INFO.backtrace.map { |l| "  #{l}" }.join("\n")
  end
end

#promptObject

Prompt shown before reading a command.



37
38
39
# File 'lib/byebug/processors/script_processor.rb', line 37

def prompt
  '(byebug:ctrl) '
end