Skip to content

Commit

Permalink
refactor Route#ast to use or-equals and block, instead of return with…
Browse files Browse the repository at this point in the history
… a cond
  • Loading branch information
goshacmd committed Jan 6, 2013
1 parent 253cdc8 commit c730bef
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions actionpack/lib/action_dispatch/journey/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c730bef

Please sign in to comment.