Module: Operandi::Callbacks
- Included in:
- Base
- Defined in:
- lib/operandi/callbacks.rb
Overview
Provides callback hooks for service and step lifecycle events.
Constant Summary collapse
- EVENTS =
Available callback events.
[ :before_step_run, :after_step_run, :around_step_run, :on_step_success, :on_step_failure, :on_step_crash, :before_service_run, :after_service_run, :around_service_run, :on_service_success, :on_service_failure, ].freeze
Instance Method Summary collapse
-
#run_callbacks(event, *args) { ... } ⇒ void
Run all callbacks for a given event.
Instance Method Details
#run_callbacks(event, *args) { ... } ⇒ void
This method returns an undefined value.
Run all callbacks for a given event.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/operandi/callbacks.rb', line 56 def run_callbacks(event, *args, &) callbacks = self.class.all_callbacks_for(event) if event.to_s.start_with?("around_") run_around_callbacks(callbacks, args, &) else run_simple_callbacks(callbacks, args) yield if block_given? end end |