mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
do not create memo objects since we'll just throw them away
This commit is contained in:
parent
d04bcf94da
commit
ee453a1ea1
2 changed files with 11 additions and 9 deletions
|
@ -19,6 +19,14 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
def simulate(string)
|
||||
ms = memos(string) { return }
|
||||
MatchData.new(ms)
|
||||
end
|
||||
|
||||
alias :=~ :simulate
|
||||
alias :match :simulate
|
||||
|
||||
def memos(string)
|
||||
input = StringScanner.new(string)
|
||||
state = [0]
|
||||
while sym = input.scan(%r([/.?]|[^/.?]+))
|
||||
|
@ -29,15 +37,10 @@ module ActionDispatch
|
|||
tt.accepting? s
|
||||
}
|
||||
|
||||
return if acceptance_states.empty?
|
||||
return yield if acceptance_states.empty?
|
||||
|
||||
memos = acceptance_states.flat_map { |x| tt.memo(x) }.compact
|
||||
|
||||
MatchData.new(memos)
|
||||
acceptance_states.flat_map { |x| tt.memo(x) }.compact
|
||||
end
|
||||
|
||||
alias :=~ :simulate
|
||||
alias :match :simulate
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -121,8 +121,7 @@ module ActionDispatch
|
|||
|
||||
def filter_routes(path)
|
||||
return [] unless ast
|
||||
data = simulator.match(path)
|
||||
data ? data.memos : []
|
||||
simulator.memos(path) { [] }
|
||||
end
|
||||
|
||||
def find_routes env
|
||||
|
|
Loading…
Reference in a new issue