Module: Resque::Integration::Hooks

Included in:
Resque, Resque
Defined in:
lib/resque/integration/hooks.rb

Overview

Backport of resque-1.24.x hooks

Defined Under Namespace

Classes: CallableArray

Instance Method Summary collapse

Instance Method Details

#after_fork(&block) ⇒ Object

Call with a block to register a hook. Call with no arguments to return all registered hooks.



38
39
40
# File 'lib/resque/integration/hooks.rb', line 38

def after_fork(&block)
  block ? register_hook(:after_fork, block) : hooks(:after_fork)
end

#after_fork=(block) ⇒ Object

Register an after_fork proc.



43
44
45
# File 'lib/resque/integration/hooks.rb', line 43

def after_fork=(block)
  register_hook(:after_fork, block)
end

#before_first_fork(&block) ⇒ Object

Call with a block to register a hook. Call with no arguments to return all registered hooks.



16
17
18
# File 'lib/resque/integration/hooks.rb', line 16

def before_first_fork(&block)
  block ? register_hook(:before_first_fork, block) : hooks(:before_first_fork)
end

#before_first_fork=(block) ⇒ Object

Register a before_first_fork proc.



21
22
23
# File 'lib/resque/integration/hooks.rb', line 21

def before_first_fork=(block)
  register_hook(:before_first_fork, block)
end

#before_fork(&block) ⇒ Object

Call with a block to register a hook. Call with no arguments to return all registered hooks.



27
28
29
# File 'lib/resque/integration/hooks.rb', line 27

def before_fork(&block)
  block ? register_hook(:before_fork, block) : hooks(:before_fork)
end

#before_fork=(block) ⇒ Object

Register a before_fork proc.



32
33
34
# File 'lib/resque/integration/hooks.rb', line 32

def before_fork=(block)
  register_hook(:before_fork, block)
end