From bea24d479037bee708d2683ca75b7a2cdf79f62d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Mon, 16 Sep 2019 23:13:49 +0900 Subject: [PATCH] Reduce Array and Hash creations in Journey find_routes --- actionpack/lib/action_dispatch/journey/router.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_dispatch/journey/router.rb b/actionpack/lib/action_dispatch/journey/router.rb index 4a6639af74..f760009217 100644 --- a/actionpack/lib/action_dispatch/journey/router.rb +++ b/actionpack/lib/action_dispatch/journey/router.rb @@ -121,7 +121,8 @@ module ActionDispatch routes.map! { |r| match_data = r.path.match(req.path_info) path_parameters = {} - match_data.names.zip(match_data.captures) { |name, val| + match_data.names.each_with_index { |name, i| + val = match_data[i + 1] path_parameters[name.to_sym] = Utils.unescape_uri(val) if val } [match_data, path_parameters, r]