class ActionDispatch::MiddlewareStack::Middleware

def ==(middleware)

def ==(middleware)
  case middleware
  when Middleware
    klass == middleware.klass
  when Class
    klass == middleware
  else
    normalize(@name) == normalize(middleware)
  end
end

def build(app)

def build(app)
  klass.new(app, *args, &block)
end

def initialize(klass_or_name, *args, &block)

def initialize(klass_or_name, *args, &block)
  @klass = nil
  if klass_or_name.respond_to?(:name)
    @klass = klass_or_name
    @name  = @klass.name
  else
    @name  = klass_or_name.to_s
  end
  @classcache = ActiveSupport::Dependencies::Reference
  @args, @block = args, block
end

def inspect

def inspect
  klass.to_s
end

def klass

def klass
  @klass || classcache[@name]
end

def normalize(object)

def normalize(object)
  object.to_s.strip.sub(/^::/, '')
end