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
-
#initialize(args, &block) ⇒ TaskContext
constructor
private
A new instance of TaskContext.
Constructor Details
#initialize(args, &block) ⇒ 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 14 15 16 |
# File 'lib/elevate/task_context.rb', line 9 def initialize(args, &block) = class << self; self; end .send(:define_method, :execute, &block) args.each do |key, value| instance_variable_set("@#{key}", value) end end |