Class: Girb::Tools::RunIrbDebugCommand
- Defined in:
- lib/girb/tools/run_irb_debug_command.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.available? ⇒ Boolean
36 37 38 39 40 |
# File 'lib/girb/tools/run_irb_debug_command.rb', line 36 def available? # Available in IRB mode (not in active debug session) # DEBUGGER__::SESSION indicates an active debug session defined?(IRB) && !defined?(DEBUGGER__::SESSION) end |
.description ⇒ Object
13 14 15 16 |
# File 'lib/girb/tools/run_irb_debug_command.rb', line 13 def description "Execute a debug command in IRB. IRB integrates with debug gem, allowing step-by-step debugging. " \ "Use this when the user asks to step through code, set breakpoints, or navigate execution." end |
.name ⇒ Object
9 10 11 |
# File 'lib/girb/tools/run_irb_debug_command.rb', line 9 def name "run_debug_command" end |
.parameters ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/girb/tools/run_irb_debug_command.rb', line 18 def parameters { type: "object", properties: { command: { type: "string", description: "The debug command to execute. Examples: 'next', 'step', 'continue', 'finish', " \ "'break sample.rb:14', 'break sample.rb:14 if: x == 1', 'info', 'backtrace'" }, auto_continue: { type: "boolean", description: "Set to true to be re-invoked after the command executes to see the new state." } }, required: ["command"] } end |
Instance Method Details
#execute(binding, command:, auto_continue: false) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/girb/tools/run_irb_debug_command.rb', line 43 def execute(binding, command:, auto_continue: false) Girb::IrbIntegration.add_pending_irb_command(command) Girb::AutoContinue.request! if auto_continue { success: true, command: command, auto_continue: auto_continue, message: auto_continue ? "Command '#{command}' will be executed. You will be re-invoked with updated context." : "Command '#{command}' will be executed after this response." } end |