Module: ActiveInteraction::Runnable Abstract
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActiveModel::Validations
- Included in:
- Base
- Defined in:
- lib/active_interaction/concerns/runnable.rb
Overview
This module is abstract.
Include and override #execute to implement a custom Runnable class.
Note:
Must be included after ‘ActiveModel::Validations`.
Runs code and provides the result.
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #errors ⇒ Errors
- #execute ⇒ Object abstract
- #result ⇒ Object?
- #result=(result) ⇒ Object?
- #valid? ⇒ Boolean
Instance Method Details
#errors ⇒ Errors
21 22 23 |
# File 'lib/active_interaction/concerns/runnable.rb', line 21 def errors @_interaction_errors end |
#execute ⇒ Object
This method is abstract.
28 29 30 |
# File 'lib/active_interaction/concerns/runnable.rb', line 28 def execute raise NotImplementedError end |
#result ⇒ Object?
34 35 36 |
# File 'lib/active_interaction/concerns/runnable.rb', line 34 def result @_interaction_result end |
#result=(result) ⇒ Object?
41 42 43 44 |
# File 'lib/active_interaction/concerns/runnable.rb', line 41 def result=(result) @_interaction_result = result @_interaction_valid = errors.empty? end |
#valid? ⇒ Boolean
47 48 49 50 51 |
# File 'lib/active_interaction/concerns/runnable.rb', line 47 def valid?(*) return @_interaction_valid if instance_variable_defined?(:@_interaction_valid) super end |