From e0c6e8c64ac3d7cf05a40acacb36dc60924af897 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA Date: Thu, 23 Sep 2021 09:20:00 +0900 Subject: [DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip] --- string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 7f9559cb83..299d506004 100644 --- a/string.c +++ b/string.c @@ -10831,7 +10831,7 @@ enc_str_scrub(rb_encoding *enc, VALUE str, VALUE repl, int cr) * * "abc\u3042\x81".scrub #=> "abc\u3042\uFFFD" * "abc\u3042\x81".scrub("*") #=> "abc\u3042*" - * "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042" + * "abc\u3042\xE3\x80".scrub{|bytes| '<'+bytes.unpack1('H*')+'>' } #=> "abc\u3042" */ static VALUE str_scrub(int argc, VALUE *argv, VALUE str) @@ -10853,7 +10853,7 @@ str_scrub(int argc, VALUE *argv, VALUE str) * * "abc\u3042\x81".scrub! #=> "abc\u3042\uFFFD" * "abc\u3042\x81".scrub!("*") #=> "abc\u3042*" - * "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack('H*')[0]+'>' } #=> "abc\u3042" + * "abc\u3042\xE3\x80".scrub!{|bytes| '<'+bytes.unpack1('H*')+'>' } #=> "abc\u3042" */ static VALUE str_scrub_bang(int argc, VALUE *argv, VALUE str) -- cgit v1.2.3