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

Use unpack1 instead of unpack and [0]

[Feature #13943][ruby-core:83027]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60061 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kazu 2017-09-29 11:00:00 +00:00
parent 2d42119903
commit 5723d9fd34

View file

@ -994,7 +994,7 @@ class ERB
# #
def url_encode(s) def url_encode(s)
s.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m| s.to_s.b.gsub(/[^a-zA-Z0-9_\-.~]/n) { |m|
sprintf("%%%02X", m.unpack("C")[0]) sprintf("%%%02X", m.unpack1("C"))
} }
end end
alias u url_encode alias u url_encode