aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorGosha Arinich <me@goshakkk.name>2013-01-06 15:38:00 +0300
committerGosha Arinich <me@goshakkk.name>2013-01-06 15:38:00 +0300
commitc730bef3d8574e48a72f5960f6d3d36ed96ca8a6 (patch)
treeab9814988e0b6c6d914a1099bf3fe7f7827c46e8 /actionpack
parent253cdc8b5b9a627287491039e11ae2381d5f0fe8 (diff)
downloadrails-c730bef3d8574e48a72f5960f6d3d36ed96ca8a6.tar.gz
rails-c730bef3d8574e48a72f5960f6d3d36ed96ca8a6.tar.bz2
rails-c730bef3d8574e48a72f5960f6d3d36ed96ca8a6.zip
refactor Route#ast to use or-equals and block, instead of return with a cond
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_dispatch/journey/route.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/journey/route.rb b/actionpack/lib/action_dispatch/journey/route.rb
index d18efd863a..41351bade4 100644
--- a/actionpack/lib/action_dispatch/journey/route.rb
+++ b/actionpack/lib/action_dispatch/journey/route.rb
@@ -30,11 +30,10 @@ module ActionDispatch
end
def ast
- return @decorated_ast if @decorated_ast
-
- @decorated_ast = path.ast
- @decorated_ast.grep(Nodes::Terminal).each { |n| n.memo = self }
- @decorated_ast
+ @decorated_ast ||= begin
+ path.ast.grep(Nodes::Terminal).each { |n| n.memo = self }
+ path.ast
+ end
end
def requirements # :nodoc: