ruby-changes:29961
From: xibbar <ko1@a...>
Date: Wed, 17 Jul 2013 08:53:00 +0900 (JST)
Subject: [ruby-changes:29961] xibbar:r42013 (trunk): * lib/erb.rb (ERB::Util#url_encode): Unuse regexp special global
xibbar 2013-07-17 08:52:43 +0900 (Wed, 17 Jul 2013) New Revision: 42013 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42013 Log: * lib/erb.rb (ERB::Util#url_encode): Unuse regexp special global variable. [Feature #8648] Thanks to fotos. Modified files: trunk/lib/erb.rb Index: lib/erb.rb =================================================================== --- lib/erb.rb (revision 42012) +++ lib/erb.rb (revision 42013) @@ -948,8 +948,8 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L948 # 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/