From 355dab7d84e0baeec896c2efc1744785a782da35 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 2 Nov 2009 01:09:35 -0800 Subject: Allow 'use "model"' as a string as well as symbol Since const_get works with a string as well as a symbol, allow that to be used. It's easier and simpler to just allow strings as use arguments than to error check and raise exceptions. So both of the following should now work: Rainbows! do use :Revactor end Rainbows! do use "Revactor" end Rainbows! will always use the symbol variant internally, however, so applications can alway expect env['rainbows.model'] to be a symbol. --- lib/rainbows/http_server.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rainbows/http_server.rb b/lib/rainbows/http_server.rb index 4c4b63b..b150ddc 100644 --- a/lib/rainbows/http_server.rb +++ b/lib/rainbows/http_server.rb @@ -31,9 +31,9 @@ module Rainbows Module === mod or raise ArgumentError, "concurrency model #{model.inspect} not supported" extend(mod) - Const::RACK_DEFAULTS['rainbows.model'] = @use = model + Const::RACK_DEFAULTS['rainbows.model'] = @use = model.to_sym Const::RACK_DEFAULTS['rack.multithread'] = !!(/Thread/ =~ model.to_s) - case model + case @use when :Rev, :EventMachine Const::RACK_DEFAULTS['rainbows.autochunk'] = true end -- cgit v1.2.3-24-ge0c7