Permalink
Browse files

fewer object allocations and method calls during route match

  • Loading branch information...
1 parent dd1f23d commit 6bd9ade0629811e4e8e0347b8f1bc2c84f811ce2 @tenderlove tenderlove committed May 21, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 actionpack/lib/action_dispatch/journey/router.rb
@@ -136,11 +136,11 @@ def find_routes env
routes.map! { |r|
match_data = r.path.match(req.path_info)
- match_names = match_data.names.map { |n| n.to_sym }
- match_values = match_data.captures.map { |v| v && Utils.unescape_uri(v) }
- info = Hash[match_names.zip(match_values).find_all { |_, y| y }]
-
- [match_data, r.defaults.merge(info), r]
+ path_parameters = {}
+ match_data.names.zip(match_data.captures) { |name,val|
+ path_parameters[name.to_sym] = Utils.unescape_uri(val) if val
+ }
+ [match_data, r.defaults.merge(path_parameters), r]
}
end

0 comments on commit 6bd9ade

Please sign in to comment.