about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-11-28 18:36:47 -0800
committerEric Wong <normalperson@yhbt.net>2009-11-29 14:49:32 -0800
commitf050fcb9e5da4adf3b5b4f65c0590360113e78fd (patch)
tree6c321faaf3ebc5f812f45541e2d5a5c1e62d0afb /lib
parent37a560c5d14c15a3da7f2c10c9ea3d6002b34fe1 (diff)
downloadrainbows-f050fcb9e5da4adf3b5b4f65c0590360113e78fd.tar.gz
Eventually we hope to be able to accept arguments like
the way Rack handlers do it:

  use :Foo, :bool1, :bool2, :option => value
Diffstat (limited to 'lib')
-rw-r--r--lib/rainbows.rb1
-rw-r--r--lib/rainbows/http_server.rb8
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/rainbows.rb b/lib/rainbows.rb
index 5521e81..f2f7af5 100644
--- a/lib/rainbows.rb
+++ b/lib/rainbows.rb
@@ -21,6 +21,7 @@ module Rainbows
     end
   end
   G = State.new(true, 0, 0, 2)
+  O = {}
 
   require 'rainbows/const'
   require 'rainbows/http_server'
diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb
index da97929..b528942 100644
--- a/lib/rainbows/http_server.rb
+++ b/lib/rainbows/http_server.rb
@@ -52,6 +52,14 @@ module Rainbows
       Module === mod or
         raise ArgumentError, "concurrency model #{model.inspect} not supported"
       extend(mod)
+      args.each do |opt|
+        case opt
+        when Hash; O.update(opt)
+        when Symbol; O[opt] = true
+        else; raise ArgumentError, "can't handle option: #{opt.inspect}"
+        end
+      end
+      mod.setup if mod.respond_to?(:setup)
       Const::RACK_DEFAULTS['rainbows.model'] = @use = model.to_sym
       Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s)
       case @use