about summary refs log tree commit homepage
path: root/lib/rainbows/http_server.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-04 01:10:52 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-04 01:10:52 -0700
commit2760c0ee2c11a5b9125e5a07374f5fdd5a93282e (patch)
tree40cb5249856419a8f18684f580ae631a9cb22bd7 /lib/rainbows/http_server.rb
parentd815b6c9533bfe7dac868ae6d43161dfaac9fab3 (diff)
downloadrainbows-2760c0ee2c11a5b9125e5a07374f5fdd5a93282e.tar.gz
:Base is default (along with the implied worker_connections=1).
This disallows nil for worker_connections, and makes.
Diffstat (limited to 'lib/rainbows/http_server.rb')
-rw-r--r--lib/rainbows/http_server.rb20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index 8ed8fa2..8fdecb6 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -15,30 +15,30 @@ module Rainbows
 
     def initialize(app, options)
       @@instance = self
+      @worker_connections = 1
       rv = super(app, options)
-      defined?(@use) or use(:ThreadPool)
-      defined?(@worker_connections) or worker_connections(4)
-      rv
+      defined?(@use) or use(:Base)
     end
 
     def use(*args)
-      return @use if args.empty?
-      model = begin
-        Rainbows.const_get(args.first)
+      model = args.shift or return @use
+      mod = begin
+        Rainbows.const_get(model)
       rescue NameError
         raise ArgumentError, "concurrency model #{model.inspect} not supported"
       end
 
-      Module === model or
+      Module === mod or
         raise ArgumentError, "concurrency model #{model.inspect} not supported"
-      extend(@use = model)
+      extend(mod)
+      @use = model
     end
 
     def worker_connections(*args)
       return @worker_connections if args.empty?
       nr = args.first
-      (Integer === nr && nr > 0) || nr.nil? or
-        raise ArgumentError, "worker_connections must be an Integer or nil"
+      (Integer === nr && nr > 0) or
+        raise ArgumentError, "worker_connections must be a positive Integer"
       @worker_connections = nr
     end