Permalink
Browse files

Refactor to not call path.ast twice

  • Loading branch information...
1 parent 706fb01 commit 94ecbb7e7bb70e56137df2e275e564fa4b5bc6fb @carlosantoniodasilva carlosantoniodasilva committed Jan 6, 2013
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/action_dispatch/journey/route.rb
@@ -31,8 +31,9 @@ def initialize(name, app, path, constraints, defaults = {})
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

0 comments on commit 94ecbb7

Please sign in to comment.