Class: Taskinator::Task::Step
- Inherits:
-
Task
- Object
- Task
- Taskinator::Task::Step
- Defined in:
- lib/taskinator/task.rb
Overview
a task which invokes the specified method on the definition the args must be intrinsic types, since they are serialized to JSON
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#can_complete_task? ⇒ Boolean
NOTE: this does not work when checking out-of-process.
- #executor ⇒ Object
-
#initialize(name, process, method, args, options = {}) ⇒ Step
constructor
A new instance of Step.
- #start ⇒ Object
Constructor Details
#initialize(name, process, method, args, options = {}) ⇒ Step
Returns a new instance of Step.
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/taskinator/task.rb', line 118 def initialize(name, process, method, args, ={}) super(name, process, ) @definition = process.definition # for convenience raise ArgumentError, 'method' if method.nil? raise NoMethodError, method unless executor.respond_to?(method) @method = method @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
116 117 118 |
# File 'lib/taskinator/task.rb', line 116 def args @args end |
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
114 115 116 |
# File 'lib/taskinator/task.rb', line 114 def definition @definition end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
115 116 117 |
# File 'lib/taskinator/task.rb', line 115 def method @method end |
Instance Method Details
#accept(visitor) ⇒ Object
144 145 146 147 148 149 |
# File 'lib/taskinator/task.rb', line 144 def accept(visitor) super visitor.visit_type(:definition) visitor.visit_attribute(:method) visitor.visit_args(:args) end |
#can_complete_task? ⇒ Boolean
NOTE: this does not work when checking out-of-process
140 141 142 |
# File 'lib/taskinator/task.rb', line 140 def can_complete_task? defined?(@is_complete) && @is_complete end |
#executor ⇒ Object
129 130 131 |
# File 'lib/taskinator/task.rb', line 129 def executor @executor ||= Taskinator::Executor.new(@definition) end |
#start ⇒ Object
133 134 135 136 137 |
# File 'lib/taskinator/task.rb', line 133 def start # ASSUMPTION: when the method returns, the task is considered to be complete executor.send(method, *args) @is_complete = true end |