Permalink
Browse files

refactor Route#ast to use or-equals and block, instead of return with…

… a cond
  • Loading branch information...
1 parent 253cdc8 commit c730bef3d8574e48a72f5960f6d3d36ed96ca8a6 @goshakkk goshakkk committed Jan 6, 2013
Showing with 4 additions and 5 deletions.
  1. +4 −5 actionpack/lib/action_dispatch/journey/route.rb
View
9 actionpack/lib/action_dispatch/journey/route.rb
@@ -30,11 +30,10 @@ def initialize(name, app, path, constraints, defaults = {})
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:

0 comments on commit c730bef

Please sign in to comment.