about summary refs log tree commit homepage
path: root/lib/yahns/config.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2013-10-30 22:16:14 +0000
committerEric Wong <normalperson@yhbt.net>2013-10-31 05:04:37 +0000
commitdee4be831cacbb8745b98b894c5e1ebc87078e2c (patch)
tree909e959ec5abc830aa21dba4346db9f578c44a1f /lib/yahns/config.rb
parent602432714cd436b6f255e6ba6bc6fffbf5eca051 (diff)
downloadyahns-dee4be831cacbb8745b98b894c5e1ebc87078e2c.tar.gz
This should allow users to more-easily enable/disable apps
and their dependent atfork_* hooks.
Diffstat (limited to 'lib/yahns/config.rb')
-rw-r--r--lib/yahns/config.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/yahns/config.rb b/lib/yahns/config.rb
index a46868b..29f5746 100644
--- a/lib/yahns/config.rb
+++ b/lib/yahns/config.rb
@@ -22,9 +22,10 @@ class Yahns::Config # :nodoc:
       return var if @block == nil
       msg = "#{var} must be called outside of #{@block.type}"
     else
-      return var if @block && ctx == @block.type
+      ctx = Array(ctx)
+      return var if @block && ctx.include?(@block.type)
       msg = @block ? "may not be used inside a #{@block.type} block" :
-                     "must be used with a #{ctx} block"
+                     "must be used with a #{ctx.join(' or ')} block"
     end
     raise ArgumentError, msg
   end
@@ -91,7 +92,7 @@ class Yahns::Config # :nodoc:
   %w(atfork_prepare atfork_parent atfork_child).each do |fn|
     eval(
     %Q(def #{fn}(*args, &blk);) <<
-    %Q(  _check_in_block(:worker_processes, :#{fn});) <<
+    %Q(  _check_in_block([:worker_processes,:app], :#{fn});) <<
     %Q(  _add_hook(:#{fn}, block_given? ? blk : args[0]);) <<
     %Q(end)
     )