Class: Charming::Tasks::Task
- Inherits:
-
Data
- Object
- Data
- Charming::Tasks::Task
- Defined in:
- lib/charming/tasks/task.rb
Overview
Task is the unit of work submitted to a task executor. It pairs a name (used by ‘on_task` handlers to route the result) with a block to invoke on the executor.
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#call ⇒ Object
Invokes the task’s block in the executor’s thread and returns its value (or raises).
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block
7 8 9 |
# File 'lib/charming/tasks/task.rb', line 7 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name
7 8 9 |
# File 'lib/charming/tasks/task.rb', line 7 def name @name end |
Instance Method Details
#call ⇒ Object
Invokes the task’s block in the executor’s thread and returns its value (or raises).
9 |
# File 'lib/charming/tasks/task.rb', line 9 def call = block.call |