class Elevate::TaskContext

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.

@api private

Public Class Methods

new(block, channel, args) click to toggle source
# File lib/elevate/task_context.rb, line 9
def initialize(block, channel, args)
  @__block = block
  @__channel = channel
  @__args = args
end

Public Instance Methods

execute() click to toggle source
# File lib/elevate/task_context.rb, line 15
def execute
  instance_exec(&@__block)
end
task_args() click to toggle source
# File lib/elevate/task_context.rb, line 19
def task_args
  @__args
end
update(*args) click to toggle source
# File lib/elevate/task_context.rb, line 23
def update(*args)
  @__channel << args if @__channel
end