diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-12 06:18:06 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-12 06:18:06 +0000 |
commit | 40d8d38909fe15a96887f4097d95d7323fc93fb7 (patch) | |
tree | d0af630d5a983259de0edc350507d3789256a160 /lib/uri | |
parent | 38694016bc226abd074c239282dc047ad7c65c55 (diff) | |
download | ruby-40d8d38909fe15a96887f4097d95d7323fc93fb7.tar.gz |
* ext/json/lib/json/pure/generator.rb,
ext/json/lib/json/pure/parser.rb, ext/openssl/lib/openssl/x509.rb,
ext/win32ole/sample/olegen.rb, lib/date/format.rb, lib/irb/context.rb,
lib/irb/workspace.rb, lib/net/http.rb, lib/net/imap.rb,
lib/rdoc/generator.rb, lib/rdoc/markup/to_html.rb,
lib/rdoc/markup/to_latex.rb, lib/rdoc/parsers/parse_c.rb,
lib/rdoc/ri/formatter.rb, lib/rexml/parsers/baseparser.rb,
lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rss/parser.rb,
lib/uri/common.rb, lib/uri/generic.rb, lib/webrick/httpresponse.rb,
lib/webrick/httpservlet/filehandler.rb, lib/yaml/baseemitter.rb,
lib/yaml/encoding.rb: performance tuning arround String#gsub.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri')
-rw-r--r-- | lib/uri/common.rb | 3 | ||||
-rw-r--r-- | lib/uri/generic.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/uri/common.rb b/lib/uri/common.rb index cf7d147cc4..f0d68884de 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -285,7 +285,8 @@ module URI # perhaps unsafe is String object unsafe = Regexp.new("[#{Regexp.quote(unsafe)}]", false, 'N') end - str.gsub(unsafe) do |us| + str.gsub(unsafe) do + us = $& tmp = '' us.each_byte do |uc| tmp << sprintf('%%%02X', uc) diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index d907e0b4b2..57fe0e4515 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -1105,7 +1105,7 @@ module URI @@to_s = Kernel.instance_method(:to_s) def inspect - @@to_s.bind(self).call.sub!(/>\z/) {" URL:#{self}>"} + @@to_s.bind(self).call.sub!(/>\z/, " URL:#{self}>") end def coerce(oth) |