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

* lib/uri/http.rb (URI::HTTP#request_uri): optimized.

decrease object allocation, and ensure always create at least one new
  object for return value.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2014-08-05 19:09:01 +00:00
parent 25d3fc8823
commit a5c923f6c1
2 changed files with 11 additions and 5 deletions

View file

@ -1,3 +1,9 @@
Wed Aug 6 00:15:10 2014 NARUSE, Yui <naruse@ruby-lang.org>
* lib/uri/http.rb (URI::HTTP#request_uri): optimized.
decrease object allocation, and ensure always create at least one new
object for return value.
Wed Aug 6 03:41:21 2014 Aaron Patterson <aaron@tenderlovemaking.com> Wed Aug 6 03:41:21 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/to_ruby.rb: backwards compatibility for * ext/psych/lib/psych/visitors/to_ruby.rb: backwards compatibility for

View file

@ -93,12 +93,12 @@ module URI
# Otherwise, the path is simply URI#path. # Otherwise, the path is simply URI#path.
# #
def request_uri def request_uri
r = path_query return nil unless @path
if r && r[0] != ?/ if @path.start_with?(?/.freeze)
r = '/' + r @query ? "#@path?#@query" : @path.dup
else
@query ? "/#@path?#@query" : "/#@path"
end end
r
end end
end end