From 94ecbb7e7bb70e56137df2e275e564fa4b5bc6fb Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Sun, 6 Jan 2013 10:52:36 -0200 Subject: [PATCH] Refactor to not call path.ast twice --- actionpack/lib/action_dispatch/journey/route.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb index 41351bade4..f8a53227f3 100644 --- a/actionpack/lib/action_dispatch/journey/route.rb +++ b/actionpack/lib/action_dispatch/journey/route.rb @@ -31,8 +31,9 @@ module ActionDispatch def ast @decorated_ast ||= begin - path.ast.grep(Nodes::Terminal).each { |n| n.memo = self } - path.ast + decorated_ast = path.ast + decorated_ast.grep(Nodes::Terminal).each { |n| n.memo = self } + decorated_ast end end