Class: Deferred::DefaultThreadpoolJob

Inherits:
Default
  • Object
show all
Includes:
ThreadpoolJob
Defined in:
lib/deferred/default.rb

Overview

Like Default but includes the ThreadpoolJob module.

Instance Attribute Summary

Attributes included from ThreadpoolJob

#on_run_block

Instance Method Summary collapse

Methods included from ThreadpoolJob

#call_on_run_block, #defer!, #handle_completion, #on_run

Methods included from InstanceMethods

#callback, #chain_err, #chain_to, #ensure_that, #errback, #errback_on_exception, #timeout

Constructor Details

#initialize(&blk) ⇒ DefaultThreadpoolJob

if you pass a block it will be used as the on_run block

Examples:


DefaultThreadpoolJob.new do 
  # do stuff
end

# is the equivalent of

dtj = DefaultThreadpoolJob.new
dtj.on_run do
  # do stuff
end


31
32
33
# File 'lib/deferred/default.rb', line 31

def initialize(&blk)
  on_run(&blk)
end