class Thin::Preforker::Callbacks

Attributes

after_fork_callbacks[RW]
before_fork_callbacks[RW]

Public Class Methods

new(filename = nil) click to toggle source
# File lib/thin/preforker/callbacks.rb, line 6
def initialize filename = nil
  @before_fork_callbacks = []
  @after_fork_callbacks = []
  
  instance_eval(open(filename).read, filename) if filename
end

Public Instance Methods

run_after_fork_callbacks(*args) click to toggle source
# File lib/thin/preforker/callbacks.rb, line 17
def run_after_fork_callbacks *args
  @after_fork_callbacks.each { |callback| callback.call(*args) }
end
run_before_fork_callbacks(*args) click to toggle source
# File lib/thin/preforker/callbacks.rb, line 13
def run_before_fork_callbacks *args
  @before_fork_callbacks.each { |callback| callback.call(*args) }
end

Private Instance Methods

after_fork(&block) click to toggle source
# File lib/thin/preforker/callbacks.rb, line 26
def after_fork &block
  @after_fork_callbacks << block
end
before_fork(&block) click to toggle source
# File lib/thin/preforker/callbacks.rb, line 22
def before_fork &block
  @before_fork_callbacks << block
end