123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::MiddlewareStack::Middleware

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
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 18

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 16

attr_reader :args, :block, :klass

#block (readonly)

[ GitHub ]

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

attr_reader :args, :block, :klass

#klass (readonly)

[ GitHub ]

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

attr_reader :args, :block, :klass

Instance Method Details

#==(middleware)

[ GitHub ]

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

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 43

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

#build_instrumented(app)

[ GitHub ]

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

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

#inspect

[ GitHub ]

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

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 24

def name; klass.name; end