summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSutou Kouhei <[email protected]>2025-04-29 07:17:47 +0900
committerHiroshi SHIBATA <[email protected]>2025-05-02 09:52:38 +0900
commitaf6d6b64eafc8f9353804cd8c8192a2afed0d6e5 ()
tree8521cc6894b73a1734f279b1d5d4459a7e205930 /ext
parenta1e627b7e3a081a9ab52b04ef4a8e4930caa0cf2 (diff)
[ruby/strscan] named_captures: fix incompatibility with
MatchData#named_captures (https://.com/ruby/strscan/pull/146) Fix https://.com/ruby/strscan/pull/145 `MatchData#named_captures` use the last matched value for each name. Reported by Linus Sellberg. Thanks!!! https://.com/ruby/strscan/commit/a6086ea322
-rw-r--r--ext/strscan/strscan.c5
1 files changed, 4 insertions, 1 deletions
@@ -2211,7 +2211,10 @@ named_captures_iter(const OnigUChar *name,
VALUE value = RUBY_Qnil;
int i;
for (i = 0; i < back_num; i++) {
- value = strscan_aref(data->self, INT2NUM(back_refs[i]));
}
rb_hash_aset(data->captures, key, value);
return 0;