diff options
author | Eric Wong <e@80x24.org> | 2013-10-30 21:05:21 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-31 05:04:35 +0000 |
commit | 5544418af3fb810ef90f33bcf88a434cd0349dc8 (patch) | |
tree | 31ccc85fac7a73c47ddb7c051bd6d2e4f74f7584 /lib/yahns/config.rb | |
parent | d58bbc251d5b91ede5af220f17bc0359789370d3 (diff) | |
download | yahns-5544418af3fb810ef90f33bcf88a434cd0349dc8.tar.gz |
It was totally unnecessary and just made things hard-to-follow.
Diffstat (limited to 'lib/yahns/config.rb')
-rw-r--r-- | lib/yahns/config.rb | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb index 9a63803..873722d 100644 --- a/lib/yahns/config.rb +++ b/lib/yahns/config.rb @@ -88,13 +88,11 @@ class Yahns::Config # :nodoc: end end - # atfork_prepare, atfork_parent, atfork_child - %w(prepare parent child).each do |x| - fn = "atfork_#{x}" + %w(atfork_prepare atfork_parent atfork_child).each do |fn| eval( %Q(def #{fn}(*args, &blk);) << %Q( _check_in_block(:worker_processes, :#{fn});) << - %Q( _add_hook("worker_", :#{fn}, block_given? ? blk : args[0]);) << + %Q( _add_hook(:#{fn}, block_given? ? blk : args[0]);) << %Q(end) ) end @@ -104,7 +102,7 @@ class Yahns::Config # :nodoc: @set[var] = (block_given? ? blk : args[0]) end - def _add_hook(pfx, var, my_proc) + def _add_hook(var, my_proc) case my_proc when Proc my_proc.arity == 0 or raise ArgumentError, @@ -114,8 +112,8 @@ class Yahns::Config # :nodoc: end # this sets: - # :worker_atfork_prepare, :worker_atfork_parent, :worker_atfork_child - key = :"#{pfx}#{var}" + # :atfork_prepare, :atfork_parent, :atfork_child + key = var.to_sym @set[key] = [] unless @set.include?(key) @set[key] << my_proc end @@ -403,7 +401,7 @@ class Yahns::Config # :nodoc: end [ :logger, :pid, :worker_processes, :user, :shutdown_timeout, :before_exec, - :worker_atfork_prepare, :worker_atfork_parent, :worker_atfork_child + :atfork_prepare, :atfork_parent, :atfork_child ].each do |var| val = @set[var] server.__send__("#{var}=", val) if val != :unset |