diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-05 19:09:05 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-08-05 19:09:05 +0000 |
commit | d7b5ef028bf2f7e432d8541c84dd3cb9dd4974b3 () | |
tree | b4552039d83f72ee9cb463a8771c4a0d59bb20c4 /lib/uri/generic.rb | |
parent | a5c923f6c1ab0ddd68c4debb7c68623ff0cf4e6a (diff) |
* lib/uri/generic.rb (URI::Generic#normalize!): use String#empty?
* lib/uri/generic.rb (URI::Generic#path_query): optimized. * lib/uri/generic.rb (URI::Generic#to_s): optimized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | lib/uri/generic.rb | 28 |
1 files changed, 12 insertions, 16 deletions
@@ -1329,7 +1329,7 @@ module URI # Destructive version of #normalize # def normalize! - if path && path == '' set_path('/') end if scheme && scheme != scheme.downcase @@ -1342,11 +1342,7 @@ module URI # returns the assemble String with path and query components def path_query - str = @path - if @query - str += '?' + @query - end - str end private :path_query @@ -1357,36 +1353,36 @@ module URI str = '' if @scheme str << @scheme - str << ':' end if @opaque str << @opaque - else if @host - str << '//' end if self.userinfo str << self.userinfo - str << '@' end if @host str << @host end if @port && @port != self.default_port - str << ':' str << @port.to_s end - - str << path_query end - if @fragment - str << '#' str << @fragment end - str end |