Class: Taski::Execution::TaskWrapper
- Inherits:
-
Object
- Object
- Taski::Execution::TaskWrapper
- Defined in:
- lib/taski/execution/task_wrapper.rb
Constant Summary collapse
- STATE_PENDING =
:pending- STATE_RUNNING =
:running- STATE_COMPLETED =
:completed
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#task ⇒ Object
readonly
Returns the value of attribute task.
Instance Method Summary collapse
-
#clean ⇒ Object
The result of cleanup.
-
#get_exported_value(method_name) ⇒ Object
The exported value.
-
#initialize(task, registry:, coordinator:) ⇒ TaskWrapper
constructor
A new instance of TaskWrapper.
-
#run ⇒ Object
The result of task execution.
Constructor Details
#initialize(task, registry:, coordinator:) ⇒ TaskWrapper
Returns a new instance of TaskWrapper.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/taski/execution/task_wrapper.rb', line 32 def initialize(task, registry:, coordinator:) @task = task @registry = registry @coordinator = coordinator @result = nil @clean_result = nil @error = nil @monitor = Monitor.new @condition = @monitor.new_cond @clean_condition = @monitor.new_cond @state = STATE_PENDING @clean_state = STATE_PENDING @timing = nil register_with_progress_display end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
242 243 244 245 246 247 248 |
# File 'lib/taski/execution/task_wrapper.rb', line 242 def method_missing(method_name, *args, &block) if @task.class.method_defined?(method_name) get_exported_value(method_name) else super end end |
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
26 27 28 |
# File 'lib/taski/execution/task_wrapper.rb', line 26 def result @result end |
#task ⇒ Object (readonly)
Returns the value of attribute task.
26 27 28 |
# File 'lib/taski/execution/task_wrapper.rb', line 26 def task @task end |
Instance Method Details
#clean ⇒ Object
Returns The result of cleanup.
57 58 59 60 |
# File 'lib/taski/execution/task_wrapper.rb', line 57 def clean execute_clean_if_needed @clean_result end |
#get_exported_value(method_name) ⇒ Object
Returns The exported value.
64 65 66 67 68 |
# File 'lib/taski/execution/task_wrapper.rb', line 64 def get_exported_value(method_name) execute_task_if_needed raise @error if @error # steep:ignore @task.public_send(method_name) end |
#run ⇒ Object
Returns The result of task execution.
50 51 52 53 54 |
# File 'lib/taski/execution/task_wrapper.rb', line 50 def run execute_task_if_needed raise @error if @error # steep:ignore @result end |