123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::MiddlewareStack::Middleware

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
ActionController::MiddlewareStack::Middleware
Inherits: Object
Defined in: actionpack/lib/action_dispatch/middleware/stack.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(klass, args, block) ⇒ Middleware

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 16

def initialize(klass, args, block)
  @klass = klass
  @args  = args
  @block = block
end

Instance Attribute Details

#args (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 14

attr_reader :args, :block, :klass

#block (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 14

attr_reader :args, :block, :klass

#klass (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 14

attr_reader :args, :block, :klass

Instance Method Details

#==(middleware)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 24

def ==(middleware)
  case middleware
  when Middleware
    klass == middleware.klass
  when Module
    klass == middleware
  end
end

#build(app)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 41

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

#build_instrumented(app)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 45

def build_instrumented(app)
  InstrumentationProxy.new(build(app), inspect)
end

#inspect

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 33

def inspect
  if klass.is_a?(Module)
    klass.to_s
  else
    klass.class.to_s
  end
end

#name

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/middleware/stack.rb', line 22

def name; klass.name; end