@@ -560,7 +560,8 @@ class StringIO
560560 #
561561 # Related: StringIO.new.
562562 #
563- def self.open : [U] (?String string, ?String? mode) { (StringIO arg) -> U } -> U
563+ def self.open : (?String string, ?String? mode) -> StringIO
564+ | [U] (?String string, ?String? mode) { (StringIO arg) -> U } -> U
564565
565566 def << : (untyped arg0) -> self
566567
@@ -970,7 +971,7 @@ class StringIO
970971 # -->
971972 # Raises NotImplementedError.
972973 #
973- def fcntl : (Integer integer_cmd, String | Integer arg ) -> Integer
974+ def fcntl : (* untyped ) -> bot
974975
975976 # <!--
976977 # rdoc-file=ext/stringio/stringio.c
@@ -994,7 +995,7 @@ class StringIO
994995 # -->
995996 # Returns 0; for compatibility with IO.
996997 #
997- def fsync : () -> Integer?
998+ def fsync : () -> Integer
998999
9991000 # <!--
10001001 # rdoc-file=ext/stringio/stringio.c
@@ -1190,7 +1191,7 @@ class StringIO
11901191 # -->
11911192 # Returns `nil`; for compatibility with IO.
11921193 #
1193- def internal_encoding : () -> Encoding
1194+ def internal_encoding : () -> nil
11941195
11951196 # <!--
11961197 # rdoc-file=ext/stringio/stringio.c
@@ -1207,7 +1208,7 @@ class StringIO
12071208 # strio = StringIO.new(nil, 'w+')
12081209 # strio.external_encoding # => nil
12091210 #
1210- def external_encoding : () -> Encoding
1211+ def external_encoding : () -> Encoding?
12111212
12121213 # <!--
12131214 # rdoc-file=ext/stringio/stringio.c
@@ -1283,7 +1284,16 @@ class StringIO
12831284 #
12841285 def read : (?int? length, ?string outbuf) -> String?
12851286
1286- def read_nonblock : (int len, ?string buf) -> String
1287+ # <!--
1288+ # rdoc-file=ext/stringio/stringio.c
1289+ # - pread(maxlen, offset) -> string
1290+ # - pread(maxlen, offset, out_string) -> string
1291+ # -->
1292+ # See IO#pread.
1293+ #
1294+ def pread : (Integer maxlen, Integer offset, ?String outbuf) -> String
1295+
1296+ def read_nonblock : (int len, ?string buf, ?exception: bool ) -> String?
12871297
12881298 def readbyte : () -> Integer
12891299
@@ -1358,6 +1368,16 @@ class StringIO
13581368 def set_encoding : (?String | Encoding ext_or_ext_int_enc) -> self
13591369 | (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
13601370
1371+ # <!--
1372+ # rdoc-file=ext/stringio/stringio.c
1373+ # - strio.set_encoding_by_bom => strio or nil
1374+ # -->
1375+ # Sets the encoding according to the BOM (Byte Order Mark) in the string.
1376+ #
1377+ # Returns `self` if the BOM is found, otherwise +nil.
1378+ #
1379+ def set_encoding_by_bom : () -> Encoding?
1380+
13611381 # <!--
13621382 # rdoc-file=ext/stringio/stringio.c
13631383 # - string -> string
@@ -1429,7 +1449,7 @@ class StringIO
14291449 #
14301450 def sync= : (boolish) -> bool
14311451
1432- def sysread : (Integer maxlen, String outbuf) -> String
1452+ def sysread : (Integer maxlen, ? String outbuf) -> String
14331453
14341454 def syswrite : (String arg0) -> Integer
14351455
@@ -1472,7 +1492,7 @@ class StringIO
14721492 # Pushes back ("unshifts") a character or integer onto the stream; see
14731493 # [Character IO](rdoc-ref:IO@Character+IO).
14741494 #
1475- def ungetc : (String arg0) -> nil
1495+ def ungetc : (String | Integer arg0) -> nil
14761496
14771497 # <!--
14781498 # rdoc-file=ext/stringio/stringio.c
@@ -1485,6 +1505,8 @@ class StringIO
14851505 #
14861506 def write : (*_ToS) -> Integer
14871507
1508+ def write_nonblock : (_ToS s, ?exception: bool ) -> Integer
1509+
14881510 # This is a deprecated alias for #each_byte.
14891511 #
14901512 def bytes : () { (Integer arg0) -> untyped } -> self
0 commit comments