Class: Taskinator::TaskWorker
- Inherits:
-
Object
- Object
- Taskinator::TaskWorker
- Defined in:
- lib/taskinator/task_worker.rb
Instance Attribute Summary collapse
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(uuid) ⇒ TaskWorker
constructor
A new instance of TaskWorker.
- #perform ⇒ Object
Constructor Details
#initialize(uuid) ⇒ TaskWorker
Returns a new instance of TaskWorker.
5 6 7 |
# File 'lib/taskinator/task_worker.rb', line 5 def initialize(uuid) @uuid = uuid end |
Instance Attribute Details
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/taskinator/task_worker.rb', line 3 def uuid @uuid end |
Instance Method Details
#perform ⇒ Object
9 10 11 12 13 14 |
# File 'lib/taskinator/task_worker.rb', line 9 def perform task = Taskinator::Task.fetch(@uuid) raise "ERROR: Task '#{@uuid}' not found." unless task return if task.paused? || task.cancelled? task.start! end |