diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-25 22:59:08 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-25 22:59:08 +0100 |
commit | 02908e11425069e5b91cbf8ec3c8344a58493ef8 (patch) | |
tree | 29e713a53211774691e2cd6f2fa5dd629fd5ae27 /actionpack/lib/action_dispatch | |
parent | 1177a40e68b6661d6d2cb4aefdd9a805459cd936 (diff) | |
download | rails-02908e11425069e5b91cbf8ec3c8344a58493ef8.tar.gz rails-02908e11425069e5b91cbf8ec3c8344a58493ef8.tar.bz2 rails-02908e11425069e5b91cbf8ec3c8344a58493ef8.zip |
As first step setup the load path and lazy compare middlewares.
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/stack.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb index 0dc1d70e37..18a2922fa7 100644 --- a/actionpack/lib/action_dispatch/middleware/stack.rb +++ b/actionpack/lib/action_dispatch/middleware/stack.rb @@ -55,7 +55,11 @@ module ActionDispatch when Class klass == middleware else - klass == ActiveSupport::Inflector.constantize(middleware.to_s) + if lazy_compare?(@klass) && lazy_compare?(middleware) + normalize(@klass) == normalize(middleware) + else + klass == ActiveSupport::Inflector.constantize(middleware.to_s) + end end end @@ -72,6 +76,14 @@ module ActionDispatch end private + def lazy_compare?(object) + object.is_a?(String) || object.is_a?(Symbol) + end + + def normalize(object) + object.to_s.strip.sub(/^::/, '') + end + def build_args Array(args).map { |arg| arg.respond_to?(:call) ? arg.call : arg } end |