Class: Fractor::Workflow::ExecutionStrategy Abstract
- Inherits:
-
Object
- Object
- Fractor::Workflow::ExecutionStrategy
- Defined in:
- lib/fractor/workflow/execution_strategy.rb
Overview
This class is abstract.
Subclasses must implement the execute method
Base class for workflow execution strategies. Defines the interface for different execution patterns.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
Instance Method Summary collapse
-
#execute(job_group) ⇒ Boolean
Execute a group of jobs according to the strategy.
-
#initialize(executor, debug: false) ⇒ ExecutionStrategy
constructor
Initialize a new execution strategy.
-
#should_execute_job?(job) ⇒ Boolean
Check if a job should be executed based on its condition.
Constructor Details
#initialize(executor, debug: false) ⇒ ExecutionStrategy
Initialize a new execution strategy.
16 17 18 19 |
# File 'lib/fractor/workflow/execution_strategy.rb', line 16 def initialize(executor, debug: false) @executor = executor @debug = debug end |
Instance Attribute Details
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
10 11 12 |
# File 'lib/fractor/workflow/execution_strategy.rb', line 10 def debug @debug end |
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
10 11 12 |
# File 'lib/fractor/workflow/execution_strategy.rb', line 10 def executor @executor end |
Instance Method Details
#execute(job_group) ⇒ Boolean
Execute a group of jobs according to the strategy.
26 27 28 |
# File 'lib/fractor/workflow/execution_strategy.rb', line 26 def execute(job_group) raise NotImplementedError, "#{self.class} must implement #execute" end |
#should_execute_job?(job) ⇒ Boolean
Check if a job should be executed based on its condition.
34 35 36 37 38 |
# File 'lib/fractor/workflow/execution_strategy.rb', line 34 def should_execute_job?(job) return true unless job.condition_proc job.condition_proc.call(executor.context) end |