Skip to content

Commit ee6642d

Browse files
committed
Split scan_full/search_full overloads by return_string_p
`return_string_p` selects the return value: the matched `String` when true, the number of bytes advanced (`Integer`) when false. Express this with `true`/`false` literal overloads instead of a single `(String | Integer)?` return type.
1 parent 3f807b4 commit ee6642d

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

stdlib/strscan/0/string_scanner.rbs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,8 @@ class StringScanner
12901290
#
12911291
# "full" means "#scan with full parameters".
12921292
#
1293-
def scan_full: (Regexp | String pattern, bool advance_pointer_p, bool return_string_p) -> (String | Integer)?
1293+
def scan_full: (Regexp | String pattern, bool advance_pointer_p, true return_string_p) -> String?
1294+
| (Regexp | String pattern, bool advance_pointer_p, false return_string_p) -> Integer?
12941295

12951296
# <!--
12961297
# rdoc-file=ext/strscan/lib/strscan/strscan.rb
@@ -1369,7 +1370,8 @@ class StringScanner
13691370
# `return_string_p` is true, otherwise returns the number of bytes advanced.
13701371
# This method does affect the match register.
13711372
#
1372-
def search_full: (Regexp | String pattern, bool advance_pointer_p, bool return_string_p) -> (String | Integer)?
1373+
def search_full: (Regexp | String pattern, bool advance_pointer_p, true return_string_p) -> String?
1374+
| (Regexp | String pattern, bool advance_pointer_p, false return_string_p) -> Integer?
13731375

13741376
# <!--
13751377
# rdoc-file=ext/strscan/strscan.c

0 commit comments

Comments
 (0)