1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Reduce Array and Hash creations in Journey find_routes

This commit is contained in:
Akira Matsuda 2019-09-16 23:13:49 +09:00
parent a1b6c1669f
commit bea24d4790

View file

@ -121,7 +121,8 @@ module ActionDispatch
routes.map! { |r| routes.map! { |r|
match_data = r.path.match(req.path_info) match_data = r.path.match(req.path_info)
path_parameters = {} 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 path_parameters[name.to_sym] = Utils.unescape_uri(val) if val
} }
[match_data, path_parameters, r] [match_data, path_parameters, r]