Class: Elevate::TaskContext Private
- Inherits:
-
Object
- Object
- Elevate::TaskContext
- Defined in:
- lib/elevate/task_context.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A blank slate for hosting task blocks.
Because task blocks run in another thread, it is dangerous to expose them to the calling context. This class acts as a sandbox for task blocks.
Instance Method Summary collapse
- #execute ⇒ Object private
-
#initialize(block, channel, args) ⇒ TaskContext
constructor
private
A new instance of TaskContext.
- #task_args ⇒ Object private
- #update(*args) ⇒ Object private
Constructor Details
#initialize(block, channel, args) ⇒ TaskContext
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of TaskContext.
9 10 11 12 13 |
# File 'lib/elevate/task_context.rb', line 9 def initialize(block, channel, args) @__block = block @__channel = channel @__args = args end |
Instance Method Details
#execute ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/elevate/task_context.rb', line 15 def execute instance_exec(&@__block) end |
#task_args ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/elevate/task_context.rb', line 19 def task_args @__args end |
#update(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/elevate/task_context.rb', line 23 def update(*args) @__channel << args if @__channel end |