initial revision
[rainbows.git] / lib / rainbows / configurator.rb
blob449cdd989c7830f327ca03fb9923027bccb7f20d
1 require 'rainbows'
2 module Rainbows
4   class Configurator < ::Unicorn::Configurator
6     def use(model)
7       begin
8         model = Rainbows.const_get(model)
9       rescue NameError
10         raise ArgumentError, "concurrency model #{model.inspect} not supported"
11       end
13       Module === model or
14         raise ArgumentError, "concurrency model #{model.inspect} not supported"
15       set[:use] = model
16     end
18     def worker_connections(nr)
19       (Integer === nr && nr > 0) || nr.nil? or
20         raise ArgumentError, "worker_connections must be an Integer or nil"
21     end
23   end
25 end