Class: SpecForge::Forge::Debug
- Defined in:
- lib/spec_forge/forge/actions/debug.rb
Overview
Action for the debug: step attribute
Triggers a debug breakpoint when a step has debug: true, invoking the configured debug handler (e.g., binding.pry) to allow interactive debugging.
Instance Attribute Summary
Attributes inherited from Action
Instance Method Summary collapse
-
#run(forge, blueprint) ⇒ void
Triggers the debug breakpoint.
Methods inherited from Action
Constructor Details
This class inherits a constructor from SpecForge::Forge::Action
Instance Method Details
#run(forge, blueprint) ⇒ void
This method returns an undefined value.
Triggers the debug breakpoint
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/spec_forge/forge/actions/debug.rb', line 21 def run(forge, blueprint) forge.display.action("Debug breakpoint triggered", symbol: :flag, symbol_styles: :yellow) callback = SpecForge.configuration.on_debug_proc if callback.nil? raise Error, <<~STRING Debug breakpoint triggered but no debug handler is configured. Add a debug handler in your forge_helper.rb: SpecForge.configure do |config| config.on_debug { binding.pry } # or byebug, debug, etc. end STRING end if callback.arity == 1 context = SpecForge::Forge.context.with(forge:, blueprint:, step:) callback.call(context) else callback.call end end |