Class: ActiveSaga::Task
- Inherits:
-
Object
- Object
- ActiveSaga::Task
- Defined in:
- lib/active_saga/task.rb
Overview
Base class for reusable workflow tasks.
Direct Known Subclasses
Class Attribute Summary collapse
-
._as_async_options ⇒ Object
readonly
Returns the value of attribute _as_async_options.
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
- #call(_ctx) ⇒ Object
- #compensate(_ctx, result: nil) ⇒ Object
-
#initialize(context) ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(context) ⇒ Task
Returns a new instance of Task.
18 19 20 |
# File 'lib/active_saga/task.rb', line 18 def initialize(context) @context = context end |
Class Attribute Details
._as_async_options ⇒ Object (readonly)
Returns the value of attribute _as_async_options.
7 8 9 |
# File 'lib/active_saga/task.rb', line 7 def @_as_async_options end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
22 23 24 |
# File 'lib/active_saga/task.rb', line 22 def context @context end |
Class Method Details
.async!(**options) ⇒ Object
9 10 11 |
# File 'lib/active_saga/task.rb', line 9 def async!(**) @_as_async_options = .deep_symbolize_keys end |
.async_options ⇒ Object
13 14 15 |
# File 'lib/active_saga/task.rb', line 13 def || {} end |
Instance Method Details
#call(_ctx) ⇒ Object
24 25 26 |
# File 'lib/active_saga/task.rb', line 24 def call(_ctx) raise NotImplementedError, "Override #call in #{self.class.name}" end |
#compensate(_ctx, result: nil) ⇒ Object
28 29 30 |
# File 'lib/active_saga/task.rb', line 28 def compensate(_ctx, result: nil) nil end |