Created
December 7, 2008 23:08
-
-
Save mischa/33279 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ActionController | |
class MiddlewareStack < Array | |
class Middleware | |
attr_reader :klass, :args, :block | |
def initialize(klass, *args, &block) | |
@klass = klass.is_a?(Class) ? klass : klass.to_s.constantize | |
@args = args | |
@block = block | |
end | |
def ==(middleware) | |
case middleware | |
when Middleware | |
klass == middleware.klass | |
when Class | |
klass == middleware | |
else | |
klass == middleware.to_s.constantize | |
end | |
end | |
def inspect | |
str = @klass.to_s | |
@args.each { |arg| str += ", #{arg.inspect}" } | |
str | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment