diff options
Diffstat (limited to 'lib/rainbows/configurator.rb')
-rw-r--r-- | lib/rainbows/configurator.rb | 25 |
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 |