aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/middleware/stack.rb
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-06-07 18:30:18 -0400
committerMikel Lindsaar <raasdnil@gmail.com>2010-06-07 18:30:18 -0400
commita16fd961310d4df5bd20df5fe64b2f764d8aa471 (patch)
tree0e54acc2ae35e985cd8c8175f051e281acbd4595 /actionpack/lib/action_dispatch/middleware/stack.rb
parent735027e58d3000bd5d939e39deabfecef83ee20c (diff)
parentd6953cbfd3b6e06eceba715c60e288b6d7db0d49 (diff)
downloadrails-a16fd961310d4df5bd20df5fe64b2f764d8aa471.tar.gz
rails-a16fd961310d4df5bd20df5fe64b2f764d8aa471.tar.bz2
rails-a16fd961310d4df5bd20df5fe64b2f764d8aa471.zip
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'actionpack/lib/action_dispatch/middleware/stack.rb')
-rw-r--r--actionpack/lib/action_dispatch/middleware/stack.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/stack.rb b/actionpack/lib/action_dispatch/middleware/stack.rb
index e3180dba77..4240e7a5d5 100644
--- a/actionpack/lib/action_dispatch/middleware/stack.rb
+++ b/actionpack/lib/action_dispatch/middleware/stack.rb
@@ -5,13 +5,13 @@ module ActionDispatch
class Middleware
attr_reader :args, :block
- def initialize(klass, *args, &block)
- @klass, @args, @block = klass, args, block
+ def initialize(klass_or_name, *args, &block)
+ @ref = ActiveSupport::Dependencies::Reference.new(klass_or_name)
+ @args, @block = args, block
end
def klass
- return @klass if @klass.respond_to?(:new)
- @klass = ActiveSupport::Inflector.constantize(@klass.to_s)
+ @ref.get
end
def ==(middleware)
@@ -21,11 +21,7 @@ module ActionDispatch
when Class
klass == middleware
else
- if lazy_compare?(@klass) && lazy_compare?(middleware)
- normalize(@klass) == normalize(middleware)
- else
- klass.name == normalize(middleware.to_s)
- end
+ normalize(@ref.name) == normalize(middleware)
end
end
@@ -39,10 +35,6 @@ module ActionDispatch
private
- def lazy_compare?(object)
- object.is_a?(String) || object.is_a?(Symbol)
- end
-
def normalize(object)
object.to_s.strip.sub(/^::/, '')
end