diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-01 15:55:48 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-04-01 15:55:48 -0700 |
commit | ee453a1ea1e35a0ef2f9f65a135c9e5d090b3dd2 (patch) | |
tree | 1de6be86e8f0bdc5aa9b0b876228a00e1865e5c0 /actionpack/lib/action_dispatch/journey | |
parent | d04bcf94da9a19d9470f920587f8d2055d3b7108 (diff) | |
download | rails-ee453a1ea1e35a0ef2f9f65a135c9e5d090b3dd2.tar.gz rails-ee453a1ea1e35a0ef2f9f65a135c9e5d090b3dd2.tar.bz2 rails-ee453a1ea1e35a0ef2f9f65a135c9e5d090b3dd2.zip |
do not create memo objects since we'll just throw them away
Diffstat (limited to 'actionpack/lib/action_dispatch/journey')
-rw-r--r-- | actionpack/lib/action_dispatch/journey/gtg/simulator.rb | 17 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/journey/router.rb | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/actionpack/lib/action_dispatch/journey/gtg/simulator.rb b/actionpack/lib/action_dispatch/journey/gtg/simulator.rb index 254c2befc4..94b0a24344 100644 --- a/actionpack/lib/action_dispatch/journey/gtg/simulator.rb +++ b/actionpack/lib/action_dispatch/journey/gtg/simulator.rb @@ -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 diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index 419e665d12..36561c71a1 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -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 |