mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Use hooks for on_booted event. (#1160)
* Use hooks for on_booted event.
Callbacks were introduced after Events#on_booted.
b24920d3ed (diff-af46a0af8a5e391324bbe812613b44a8R25)
* Fix typo.
This commit is contained in:
parent
57c6dd947f
commit
c7c40f307e
1 changed files with 4 additions and 6 deletions
|
@ -35,8 +35,6 @@ module Puma
|
|||
|
||||
@debug = ENV.key? 'PUMA_DEBUG'
|
||||
|
||||
@on_booted = []
|
||||
|
||||
@hooks = Hash.new { |h,k| h[k] = [] }
|
||||
end
|
||||
|
||||
|
@ -49,7 +47,7 @@ module Puma
|
|||
@hooks[hook].each { |t| t.call(*args) }
|
||||
end
|
||||
|
||||
# Register a callbock for a given hook
|
||||
# Register a callback for a given hook
|
||||
#
|
||||
def register(hook, obj=nil, &blk)
|
||||
if obj and blk
|
||||
|
@ -125,12 +123,12 @@ module Puma
|
|||
end
|
||||
end
|
||||
|
||||
def on_booted(&b)
|
||||
@on_booted << b
|
||||
def on_booted(&block)
|
||||
register(:on_booted, &block)
|
||||
end
|
||||
|
||||
def fire_on_booted!
|
||||
@on_booted.each { |b| b.call }
|
||||
fire(:on_booted)
|
||||
end
|
||||
|
||||
DEFAULT = new(STDOUT, STDERR)
|
||||
|
|
Loading…
Reference in a new issue