strscan 3.0.7 → 3.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/strscan/strscan.c +12 -8
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 966671b1cf9f378e37f9294dd7274648172ca82bfed40b3507d7776d53e3f948
4
- data.tar.gz: 91d0a754b9365f048dd3abcb8f4d3faf20b7c747fe27c0989531266f5610982f
3
+ metadata.gz: 55b86790043219a7a959b084db7665576bd1d6342b4cbef90dbfe4da131920cb
4
+ data.tar.gz: f80e735c0376d490dd5f565a39cbdf68a97b0f6bd34d01d16b493d7205453fa1
5
5
  SHA512:
6
- metadata.gz: aa2d55b49aad4e56dad583ec5c5b1fdc6ad0278c16ecfd2d730dd3ad198fd7b1ea112d625e647147cacf6dae1a670b34f4037a7552cc519f856e081975286d99
7
- data.tar.gz: 5282025fe064fc0088721ce5d0b701f6145e483e5f1d26837a2c710a5da54f5415e669fd0081d00ea84f790362ed14453f487662f25b8e29616d51f0f6b1eb75
6
+ metadata.gz: 95157252dd0df23caafd499d2e4bc09821cfb637d5dc1bc6f3ea2c290aa7263269899145fa6fd4e0b9ca5757fc33aaee694bd1a11dc0219f4760648bbafa0408
7
+ data.tar.gz: df2aa355dfa01e01ce60fea0ea13dc058dbf1067b51eb54086adc1a9ef5e6a210d05a073a916190490dc7b0f315133c010edcdac3344098f161a555915722e35
@@ -22,7 +22,7 @@ extern size_t onig_region_memsize(const struct re_registers *regs);
22
22
 
23
23
  #include <stdbool.h>
24
24
 
25
- #define STRSCAN_VERSION "3.0.7"
25
+ #define STRSCAN_VERSION "3.0.8"
26
26
 
27
27
  /* =======================================================================
28
28
  Data Type Definitions
@@ -1243,10 +1243,10 @@ strscan_size(VALUE self)
1243
1243
  * If nothing was priorly matched, it returns nil.
1244
1244
  *
1245
1245
  * s = StringScanner.new("Fri Dec 12 1975 14:39")
1246
- * s.scan(/(\w+) (\w+) (\d+) /) # -> "Fri Dec 12 "
1247
- * s.captures # -> ["Fri", "Dec", "12"]
1248
- * s.scan(/(\w+) (\w+) (\d+) /) # -> nil
1249
- * s.captures # -> nil
1246
+ * s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> "Fri Dec 12 "
1247
+ * s.captures # -> ["Fri", "Dec", "12", nil]
1248
+ * s.scan(/(\w+) (\w+) (\d+) (1980)?/) # -> nil
1249
+ * s.captures # -> nil
1250
1250
  */
1251
1251
  static VALUE
1252
1252
  strscan_captures(VALUE self)
@@ -1262,9 +1262,13 @@ strscan_captures(VALUE self)
1262
1262
  new_ary = rb_ary_new2(num_regs);
1263
1263
 
1264
1264
  for (i = 1; i < num_regs; i++) {
1265
- VALUE str = extract_range(p,
1266
- adjust_register_position(p, p->regs.beg[i]),
1267
- adjust_register_position(p, p->regs.end[i]));
1265
+ VALUE str;
1266
+ if (p->regs.beg[i] == -1)
1267
+ str = Qnil;
1268
+ else
1269
+ str = extract_range(p,
1270
+ adjust_register_position(p, p->regs.beg[i]),
1271
+ adjust_register_position(p, p->regs.end[i]));
1268
1272
  rb_ary_push(new_ary, str);
1269
1273
  }
1270
1274
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strscan
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-10-11 00:00:00.000000000 Z
13
+ date: 2024-01-12 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Provides lexical scanning operations on a String.
16
16
  email: