[前][次][番号順一覧][スレッド一覧]

ruby-changes:62809

From: Jeremy <ko1@a...>
Date: Thu, 3 Sep 2020 02:45:04 +0900 (JST)
Subject: [ruby-changes:62809] d9b8411a7b (master): Document that StringScanner#matched_size returns size in bytes [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=d9b8411a7b

From d9b8411a7be4c9e300b75bc374f29e6965ab3040 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Wed, 2 Sep 2020 10:40:17 -0700
Subject: Document that StringScanner#matched_size returns size in bytes [ci
 skip]

Fixes [Bug #17139]

diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 7edd1bf..61c8d89 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -1089,8 +1089,9 @@ strscan_matched(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1089
 }
 
 /*
- * Returns the size of the most recent match (see #matched), or +nil+ if there
- * was no recent match.
+ * Returns the size of the most recent match in bytes, or +nil+ if there
+ * was no recent match.  This is different than <tt>matched.size</tt>,
+ * which will return the size in characters.
  *
  *   s = StringScanner.new('test string')
  *   s.check /\w+/           # -> "test"
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]