Class: RubynCode::Hooks::Runner
- Inherits:
-
Object
- Object
- RubynCode::Hooks::Runner
- Defined in:
- lib/rubyn_code/hooks/runner.rb
Overview
Executes registered hooks for a given event in priority order.
Hook execution is defensive: exceptions raised by individual hooks are caught and logged rather than allowed to crash the agent. Special semantics apply to :pre_tool_use (deny gating) and :post_tool_use (output transformation).
Instance Method Summary collapse
-
#fire(event, **context) ⇒ Hash, ...
Fires all hooks for the given event with the supplied context.
-
#initialize(registry: Registry.new) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
Instance Method Details
#fire(event, **context) ⇒ Hash, ...
Fires all hooks for the given event with the supplied context.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rubyn_code/hooks/runner.rb', line 25 def fire(event, **context) hooks = @registry.hooks_for(event) return if hooks.empty? case event when :pre_tool_use fire_pre_tool_use(hooks, context) when :post_tool_use fire_post_tool_use(hooks, context) else fire_generic(hooks, event, context) end end |