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

* lib/erb.rb (ERB::Util#url_encode): Unuse regexp special global

variable. [Feature #8648] Thanks to fotos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2013-07-16 23:52:43 +00:00
parent 8795574510
commit 747b1a3188

View file

@ -948,8 +948,8 @@ class ERB
# Programming%20Ruby%3A%20%20The%20Pragmatic%20Programmer%27s%20Guide
#
def url_encode(s)
s.to_s.b.gsub(/[^a-zA-Z0-9_\-.]/n) {
sprintf("%%%02X", $&.unpack("C")[0])
s.to_s.b.gsub(/[^a-zA-Z0-9_\-.]/n) { |m|
sprintf("%%%02X", m.unpack("C")[0])
}
end
alias u url_encode