Module: ActiveInteractor::Interactor::Perform
- Included in:
- Base
- Defined in:
- lib/active_interactor/interactor/perform.rb
Overview
Defined Under Namespace
Modules: ClassMethods Classes: Options
Instance Method Summary collapse
-
#deep_dup ⇒ Base
Duplicate an interactor instance as well as it's #options and context instances.
-
#execute_perform ⇒ Object
private
Run the interactor instance's #perform with callbacks and validation.
-
#execute_perform! ⇒ Object
private
Run the interactor instance's #perform with callbacks and validation without rescuing Error::ContextFailure.
-
#options ⇒ Options
Options for the interactor #perform.
-
#perform ⇒ Object
abstract
The steps to run when an interactor is called.
-
#rollback ⇒ Object
abstract
The steps to run when an interactor fails.
-
#with_options(options) ⇒ self
private
Set options for an interactor's #perform.
Instance Method Details
#deep_dup ⇒ Base
Duplicate an interactor instance as well as it's #options and context instances.
177 178 179 180 181 182 183 |
# File 'lib/active_interactor/interactor/perform.rb', line 177 def deep_dup dupped = dup %w[@context @options].each do |variable| dupped.instance_variable_set(variable, instance_variable_get(variable)&.dup) end dupped end |
#execute_perform ⇒ Object
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.
171 |
# File 'lib/active_interactor/interactor/perform.rb', line 171 delegate :execute_perform, :execute_perform!, to: :worker |
#execute_perform! ⇒ Object
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.
171 |
# File 'lib/active_interactor/interactor/perform.rb', line 171 delegate :execute_perform, :execute_perform!, to: :worker |
#options ⇒ Options
Options for the interactor #perform
188 189 190 |
# File 'lib/active_interactor/interactor/perform.rb', line 188 def @options ||= ActiveInteractor::Interactor::Perform::Options.new end |
#perform ⇒ Object
interactors should override #perform with the appropriate steps and context mutations required for the interactor to do its work.
The steps to run when an interactor is called. An interactor's #perform method should never be called directly on an interactor instance and should instead be invoked by the interactor's class method .perform.
210 |
# File 'lib/active_interactor/interactor/perform.rb', line 210 def perform; end |
#rollback ⇒ Object
interactors should override #rollback with the appropriate steps and context mutations required for the interactor to roll back its work.
The steps to run when an interactor fails. An interactor's #rollback method should never be called directly and is instead called by the interactor's context when #fail is called.
236 |
# File 'lib/active_interactor/interactor/perform.rb', line 236 def rollback; end |
#with_options(options) ⇒ self
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.
Set options for an interactor's #perform
244 245 246 247 248 249 250 251 |
# File 'lib/active_interactor/interactor/perform.rb', line 244 def () @options = if .is_a?(ActiveInteractor::Interactor::Perform::Options) else ActiveInteractor::Interactor::Perform::Options.new() end self end |