Class: Byebug::CommandProcessor
- Inherits:
-
Object
- Object
- Byebug::CommandProcessor
- Extended by:
- Forwardable
- Includes:
- Helpers::EvalHelper
- Defined in:
- lib/byebug/processors/command_processor.rb
Overview
Processes commands in regular mode.
You can override this class to create your own command processor that, for example, whitelists only certain commands to be executed.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
-
#prev_line ⇒ Object
Returns the value of attribute prev_line.
Instance Method Summary collapse
- #at_breakpoint(brkpt) ⇒ Object
- #at_catchpoint(exception) ⇒ Object
- #at_end ⇒ Object
- #at_line ⇒ Object
- #at_return(return_value) ⇒ Object
- #at_tracing ⇒ Object
-
#command_list ⇒ Object
Available commands.
-
#initialize(context, interface = LocalInterface.new) ⇒ CommandProcessor
constructor
A new instance of CommandProcessor.
- #printer ⇒ Object
-
#proceed! ⇒ Object
Let the execution continue.
-
#process_commands ⇒ Object
Handle byebug commands.
Methods included from Helpers::EvalHelper
#error_eval, #multiple_thread_eval, #separate_thread_eval, #silent_eval, #warning_eval
Constructor Details
#initialize(context, interface = LocalInterface.new) ⇒ CommandProcessor
Returns a new instance of CommandProcessor.
23 24 25 26 27 28 29 |
# File 'lib/byebug/processors/command_processor.rb', line 23 def initialize(context, interface = LocalInterface.new) @context = context @interface = interface @proceed = false @prev_line = nil end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
21 22 23 |
# File 'lib/byebug/processors/command_processor.rb', line 21 def context @context end |
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
21 22 23 |
# File 'lib/byebug/processors/command_processor.rb', line 21 def interface @interface end |
#prev_line ⇒ Object
Returns the value of attribute prev_line.
20 21 22 |
# File 'lib/byebug/processors/command_processor.rb', line 20 def prev_line @prev_line end |
Instance Method Details
#at_breakpoint(brkpt) ⇒ Object
64 65 66 67 68 |
# File 'lib/byebug/processors/command_processor.rb', line 64 def at_breakpoint(brkpt) number = Byebug.breakpoints.index(brkpt) + 1 puts "Stopped by breakpoint #{number} at #{frame.file}:#{frame.line}" end |
#at_catchpoint(exception) ⇒ Object
70 71 72 |
# File 'lib/byebug/processors/command_processor.rb', line 70 def at_catchpoint(exception) puts "Catchpoint at #{context.location}: `#{exception}'" end |
#at_end ⇒ Object
80 81 82 |
# File 'lib/byebug/processors/command_processor.rb', line 80 def at_end process_commands end |
#at_line ⇒ Object
54 55 56 |
# File 'lib/byebug/processors/command_processor.rb', line 54 def at_line process_commands end |
#at_return(return_value) ⇒ Object
74 75 76 77 78 |
# File 'lib/byebug/processors/command_processor.rb', line 74 def at_return(return_value) puts "Return value is: #{safe_inspect(return_value)}" process_commands end |
#at_tracing ⇒ Object
58 59 60 61 62 |
# File 'lib/byebug/processors/command_processor.rb', line 58 def at_tracing puts "Tracing: #{context.full_location}" run_auto_cmds(2) end |
#command_list ⇒ Object
Available commands
50 51 52 |
# File 'lib/byebug/processors/command_processor.rb', line 50 def command_list @command_list ||= CommandList.new(commands) end |
#printer ⇒ Object
31 32 33 |
# File 'lib/byebug/processors/command_processor.rb', line 31 def printer @printer ||= Printers::Plain.new end |
#proceed! ⇒ Object
Let the execution continue
87 88 89 |
# File 'lib/byebug/processors/command_processor.rb', line 87 def proceed! @proceed = true end |
#process_commands ⇒ Object
Handle byebug commands.
94 95 96 97 98 99 100 |
# File 'lib/byebug/processors/command_processor.rb', line 94 def process_commands before_repl repl ensure after_repl end |