Class: ActiveInteractor::Interactor::Worker Private
- Inherits:
-
Object
- Object
- ActiveInteractor::Interactor::Worker
- Defined in:
- lib/active_interactor/interactor/worker.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A worker class to call interactor #perform and #rollback methods in a thread safe manner.
Instance Method Summary collapse
-
#execute_perform ⇒ Class
private
Run the interactor instance's #perform with callbacks and validation.
-
#execute_perform! ⇒ Class
private
Run the interactor instance's #perform with callbacks and validation without rescuing Error::ContextFailure.
-
#execute_rollback ⇒ Boolean
private
Run the interactor instance's #rollback with callbacks.
-
#initialize(interactor) ⇒ Worker
constructor
private
Initialize a new instance of Worker.
Constructor Details
#initialize(interactor) ⇒ Worker
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize a new instance of ActiveInteractor::Interactor::Worker
16 17 18 |
# File 'lib/active_interactor/interactor/worker.rb', line 16 def initialize(interactor) @interactor = interactor.deep_dup end |
Instance Method Details
#execute_perform ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the interactor instance's #perform with callbacks and validation.
23 24 25 26 27 28 |
# File 'lib/active_interactor/interactor/worker.rb', line 23 def execute_perform execute_perform! rescue Error::ContextFailure => e ActiveInteractor.logger.error("ActiveInteractor: #{e}") context end |
#execute_perform! ⇒ Class
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the interactor instance's #perform with callbacks and validation without rescuing Error::ContextFailure.
35 36 37 38 39 |
# File 'lib/active_interactor/interactor/worker.rb', line 35 def execute_perform! execute_context! rescue StandardError => e handle_error(e) end |
#execute_rollback ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the interactor instance's #rollback with callbacks
44 45 46 47 48 |
# File 'lib/active_interactor/interactor/worker.rb', line 44 def execute_rollback return if interactor..skip_rollback execute_interactor_rollback! end |