提交 b610104e 编写于 作者: A Aaron Patterson

mutate the path string to avoid object allocations

上级 5f49da8c
......@@ -45,14 +45,14 @@ def url_for(options)
if options[:trailing_slash]
if path.include?('?')
result << path.sub(/\?/, '/\&')
path.sub!(/\?/, '/\&')
else
result << path.sub(/[^\/]\z|\A\z/, '\&/')
path.sub!(/[^\/]\z|\A\z/, '\&/')
end
else
result << path
end
result << path
if options.key? :params
params = options[:params].is_a?(Hash) ?
options[:params] :
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册