class ActionDispatch::MiddlewareStack::Middleware - actionpack-3.2.22 Documentation

# class ActionDispatch::MiddlewareStack::Middleware

### Attributes

args[R]
block[R]
classcache[R]
name[R]

### Public Class Methods

new(klass_or_name, *args, &block) click to toggle source

    # File lib/action_dispatch/middleware/stack.rb, line 9
    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

### Public Instance Methods

==(middleware) click to toggle source

    # File lib/action_dispatch/middleware/stack.rb, line 27
    def ==(middleware)
      case middleware
      when Middleware
        klass == middleware.klass
      when Class
        klass == middleware
      else
        normalize(@name) == normalize(middleware)
      end
    end

build(app) click to toggle source

    # File lib/action_dispatch/middleware/stack.rb, line 42
    def build(app)
      klass.new(app, *args, &block)
    end

inspect() click to toggle source

    # File lib/action_dispatch/middleware/stack.rb, line 38
    def inspect
      klass.to_s
    end

klass() click to toggle source

    # File lib/action_dispatch/middleware/stack.rb, line 23
    def klass
      @klass || classcache[@name]
    end