diff options
Diffstat (limited to 'lib/rainbows/configurator.rb')
-rw-r--r-- | lib/rainbows/configurator.rb | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/lib/rainbows/configurator.rb b/lib/rainbows/configurator.rb deleted file mode 100644 index 1d25f9e..0000000 --- a/lib/rainbows/configurator.rb +++ /dev/null @@ -1,45 +0,0 @@ -# -*- encoding: binary -*- -module Rainbows - - class Configurator < ::Unicorn::Configurator - - # configures rainbows - def rainbows(&block) - block_given? or raise ArgumentError, "rainbows requires a block" - instance_eval(&block) - end - - private - - def use(model) - assert_in_rainbows - 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) - assert_in_rainbows - (Integer === nr && nr > 0) || nr.nil? or - raise ArgumentError, "worker_connections must be an Integer or nil" - set[:worker_connections] = nr - end - - private - - def assert_in_rainbows # :nodoc: - c = caller - c.grep(/`rainbows'\z/).empty? and - raise ArgumentError, - "#{%r!`(\w+)'\z!.match(c.first)[1]} must be called in `rainbows'" - end - - end - -end |