strscan 3.0.7 → 3.0.9

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 +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 966671b1cf9f378e37f9294dd7274648172ca82bfed40b3507d7776d53e3f948
4
- data.tar.gz: 91d0a754b9365f048dd3abcb8f4d3faf20b7c747fe27c0989531266f5610982f
3
+ metadata.gz: 5b1aee872d83aeba4bed1ba048f074487816c3b50fbc872866eb015f16327166
4
+ data.tar.gz: 8a10e923df28f57169ccf191c14998fad8c41b857be6932b4b6a86815a5572fd
5
5
  SHA512:
6
- metadata.gz: aa2d55b49aad4e56dad583ec5c5b1fdc6ad0278c16ecfd2d730dd3ad198fd7b1ea112d625e647147cacf6dae1a670b34f4037a7552cc519f856e081975286d99
7
- data.tar.gz: 5282025fe064fc0088721ce5d0b701f6145e483e5f1d26837a2c710a5da54f5415e669fd0081d00ea84f790362ed14453f487662f25b8e29616d51f0f6b1eb75
6
+ metadata.gz: 9c58130e6087c910bcdb412f866f000f191b1db15cc42121c1a95c88b78f4baf14776a45ea925f34cd7c6b5c503d8b16908f3cd5a311376bfd948314ac531932
7
+ data.tar.gz: f974920bfea3fb57b8b01e685c0338062a8bc4df4c29397ed61272864f4b4b623c243fe9fdf212a9e7afecf78a5d78fb87cca09858f77ac8abe1858f79542530
@@ -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.9"
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.9
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-21 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Provides lexical scanning operations on a String.
16
16
  email:
@@ -46,7 +46,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  requirements: []
49
- rubygems_version: 3.3.26
49
+ rubygems_version: 3.5.3
50
50
  signing_key:
51
51
  specification_version: 4
52
52
  summary: Provides lexical scanning operations on a String.