class Procrastinate::Task::Callable
A task that calls the block and returns the result of execution.
Attributes
block[R]
result[R]
Public Class Methods
new(block)
click to toggle source
# File lib/procrastinate/task/callable.rb, line 11 def initialize(block) @b = block @result = Result.new end
Public Instance Methods
run(endpoint)
click to toggle source
Runs this task. Gets passed an endpoint that can be used to communicate values back to the master. Every time you write a value to that endpoint (using send), the server will call incoming_message on the task object in the master process. This allows return values and other communication from children to the master (and to the caller in this case).
# File lib/procrastinate/task/callable.rb, line 22 def run(endpoint) r = @b.call endpoint.call(r) if endpoint end