about summary refs log tree commit homepage
path: root/lib/rainbows/configurator.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-02 20:44:03 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-02 21:21:28 -0700
commit37a12997628fcab722512f8a6370b92d44e33529 (patch)
tree9ced4ceaee3d4d6ce21dd1742f037d1d79a01e61 /lib/rainbows/configurator.rb
downloadrainbows-37a12997628fcab722512f8a6370b92d44e33529.tar.gz
No tests yet, but the old "gossamer" and "rainbows" branches
seem to be basically working.
Diffstat (limited to 'lib/rainbows/configurator.rb')
-rw-r--r--lib/rainbows/configurator.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/rainbows/configurator.rb b/lib/rainbows/configurator.rb
new file mode 100644
index 0000000..449cdd9
--- /dev/null
+++ b/lib/rainbows/configurator.rb
@@ -0,0 +1,25 @@
+require 'rainbows'
+module Rainbows
+
+  class Configurator < ::Unicorn::Configurator
+
+    def use(model)
+      begin
+        model = Rainbows.const_get(model)
+      rescue NameError
+        raise ArgumentError, "concurrency model #{model.inspect} not supported"
+      end
+
+      Module === model or
+        raise ArgumentError, "concurrency model #{model.inspect} not supported"
+      set[:use] = model
+    end
+
+    def worker_connections(nr)
+      (Integer === nr && nr > 0) || nr.nil? or
+        raise ArgumentError, "worker_connections must be an Integer or nil"
+    end
+
+  end
+
+end