提交 6bd9ade0 编写于 作者: A Aaron Patterson

fewer object allocations and method calls during route match

上级 dd1f23df
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册