diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-08 23:05:05 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2015-06-08 23:05:05 -0300 |
commit | d0de07d21e29149fcd576df1e1f4547fac399603 (patch) | |
tree | 87d6a1f1075caeeb0e31b99be97cc97495da5a68 | |
parent | bbbe1a58e60da079d5d353777561d1c998549571 (diff) | |
parent | b28b192af194ca63fad6e3cde3b56b78f9132cac (diff) | |
download | rails-d0de07d21e29149fcd576df1e1f4547fac399603.tar.gz rails-d0de07d21e29149fcd576df1e1f4547fac399603.tar.bz2 rails-d0de07d21e29149fcd576df1e1f4547fac399603.zip |
Merge pull request #20486 from repinel/improve-gsub-and-global-vars
Use block variable instead of global
-rw-r--r-- | activesupport/lib/active_support/core_ext/uri.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb index bfe0832b37..0b2ff817c3 100644 --- a/activesupport/lib/active_support/core_ext/uri.rb +++ b/activesupport/lib/active_support/core_ext/uri.rb @@ -12,7 +12,7 @@ unless str == parser.unescape(parser.escape(str)) # YK: My initial experiments say yes, but let's be sure please enc = str.encoding enc = Encoding::UTF_8 if enc == Encoding::US_ASCII - str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(enc) + str.gsub(escaped) { |match| [match[1, 2].hex].pack('C') }.force_encoding(enc) end end end |