Class: ActionDispatch::MiddlewareStack

Inherits:
Array
  • Object
show all
Defined in:
lib/rack_timer/stack.rb

Defined Under Namespace

Classes: Middleware, RackTimer

Instance Method Summary collapse

Instance Method Details

#build(app = nil, &block) ⇒ Object

overriding this in order to wrap the incoming app in a RackTimer, which gives us timing on the final piece of Middleware, which for Rails is the routing plus the actual Application action



70
71
72
73
74
# File 'lib/rack_timer/stack.rb', line 70

def build(app = nil, &block)
  app ||= block
  raise "MiddlewareStack#build requires an app" unless app
  reverse.inject(RackTimer.new(app)) { |a, e| e.build(a) }
end