From 672e77eb0a85b72aceba4dcbaf06040278fc5989 Mon Sep 17 00:00:00 2001 From: Merlyn Albery-Speyer Date: Thu, 16 Jan 2014 11:38:25 -0800 Subject: [PATCH] Make compatible with Rails 4 - ActionDispatch::MiddlewareStack is now an Enumeratble not an Array --- lib/rack_timer/stack.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rack_timer/stack.rb b/lib/rack_timer/stack.rb index 72f42e2..f34c64b 100644 --- a/lib/rack_timer/stack.rb +++ b/lib/rack_timer/stack.rb @@ -1,5 +1,5 @@ module ActionDispatch - class MiddlewareStack < Array + class MiddlewareStack # this class will wrap around each Rack-based middleware and take timing snapshots of how long # each middleware takes to execute @@ -70,7 +70,7 @@ def build(app) 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) } + to_a.reverse.inject(RackTimer.new(app)) { |a, e| e.build(a) } end end