rbs 3.0.0.dev.2 → 3.0.0.dev.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/comments.yml +2 -1
  3. data/.github/workflows/ruby.yml +4 -0
  4. data/Gemfile.lock +11 -11
  5. data/Rakefile +2 -2
  6. data/Steepfile +1 -1
  7. data/core/array.rbs +573 -423
  8. data/core/basic_object.rbs +11 -39
  9. data/core/binding.rbs +1 -1
  10. data/core/builtin.rbs +8 -0
  11. data/core/class.rbs +37 -0
  12. data/core/comparable.rbs +7 -18
  13. data/core/complex.rbs +2 -2
  14. data/core/data.rbs +419 -0
  15. data/core/dir.rbs +52 -104
  16. data/core/encoding.rbs +22 -181
  17. data/core/enumerable.rbs +212 -175
  18. data/core/enumerator/product.rbs +96 -0
  19. data/core/enumerator.rbs +57 -8
  20. data/core/errors.rbs +8 -2
  21. data/core/exception.rbs +41 -0
  22. data/core/fiber.rbs +95 -12
  23. data/core/file.rbs +840 -275
  24. data/core/file_test.rbs +34 -19
  25. data/core/float.rbs +40 -96
  26. data/core/gc.rbs +15 -3
  27. data/core/hash.rbs +113 -175
  28. data/core/integer.rbs +85 -145
  29. data/core/io/buffer.rbs +187 -60
  30. data/core/io/wait.rbs +28 -16
  31. data/core/io.rbs +1859 -1389
  32. data/core/kernel.rbs +525 -961
  33. data/core/match_data.rbs +306 -142
  34. data/core/math.rbs +506 -234
  35. data/core/method.rbs +0 -24
  36. data/core/module.rbs +110 -17
  37. data/core/nil_class.rbs +2 -0
  38. data/core/numeric.rbs +76 -144
  39. data/core/object.rbs +88 -212
  40. data/core/proc.rbs +17 -5
  41. data/core/process.rbs +22 -5
  42. data/core/ractor.rbs +1 -1
  43. data/core/random.rbs +20 -3
  44. data/core/range.rbs +91 -89
  45. data/core/rational.rbs +2 -3
  46. data/core/rbs/unnamed/argf.rbs +177 -120
  47. data/core/rbs/unnamed/env_class.rbs +89 -163
  48. data/core/rbs/unnamed/random.rbs +36 -12
  49. data/core/refinement.rbs +8 -0
  50. data/core/regexp.rbs +462 -272
  51. data/core/ruby_vm.rbs +210 -0
  52. data/{stdlib/set/0 → core}/set.rbs +43 -47
  53. data/core/string.rbs +1403 -1332
  54. data/core/string_io.rbs +191 -107
  55. data/core/struct.rbs +67 -63
  56. data/core/symbol.rbs +187 -201
  57. data/core/thread.rbs +40 -35
  58. data/core/time.rbs +902 -826
  59. data/core/trace_point.rbs +55 -6
  60. data/core/unbound_method.rbs +48 -24
  61. data/docs/collection.md +4 -0
  62. data/docs/syntax.md +55 -0
  63. data/ext/rbs_extension/parser.c +5 -6
  64. data/lib/rbs/cli.rb +6 -1
  65. data/lib/rbs/collection/cleaner.rb +8 -1
  66. data/lib/rbs/collection/config/lockfile.rb +3 -1
  67. data/lib/rbs/collection/config/lockfile_generator.rb +16 -14
  68. data/lib/rbs/collection/config.rb +1 -1
  69. data/lib/rbs/collection/sources/git.rb +9 -2
  70. data/lib/rbs/collection/sources/local.rb +79 -0
  71. data/lib/rbs/collection/sources.rb +8 -1
  72. data/lib/rbs/environment.rb +6 -5
  73. data/lib/rbs/environment_loader.rb +3 -2
  74. data/lib/rbs/errors.rb +18 -0
  75. data/lib/rbs/locator.rb +26 -7
  76. data/lib/rbs/sorter.rb +2 -2
  77. data/lib/rbs/version.rb +1 -1
  78. data/sig/collection/sources.rbs +32 -3
  79. data/sig/environment.rbs +2 -3
  80. data/sig/locator.rbs +14 -2
  81. data/sig/shims/{abstract_syntax_tree.rbs → _abstract_syntax_tree.rbs} +0 -0
  82. data/stdlib/bigdecimal/0/big_decimal.rbs +16 -13
  83. data/stdlib/cgi/0/core.rbs +16 -0
  84. data/stdlib/coverage/0/coverage.rbs +50 -8
  85. data/stdlib/csv/0/csv.rbs +1 -1
  86. data/stdlib/date/0/date.rbs +856 -726
  87. data/stdlib/date/0/date_time.rbs +83 -210
  88. data/stdlib/erb/0/erb.rbs +13 -36
  89. data/stdlib/etc/0/etc.rbs +127 -20
  90. data/stdlib/fileutils/0/fileutils.rbs +1290 -381
  91. data/stdlib/logger/0/logger.rbs +466 -316
  92. data/stdlib/net-http/0/net-http.rbs +2211 -534
  93. data/stdlib/nkf/0/nkf.rbs +5 -5
  94. data/stdlib/objspace/0/objspace.rbs +31 -14
  95. data/stdlib/openssl/0/openssl.rbs +11 -7
  96. data/stdlib/optparse/0/optparse.rbs +20 -17
  97. data/stdlib/pathname/0/pathname.rbs +21 -4
  98. data/stdlib/pstore/0/pstore.rbs +378 -154
  99. data/stdlib/pty/0/pty.rbs +24 -8
  100. data/stdlib/ripper/0/ripper.rbs +1650 -0
  101. data/stdlib/socket/0/addrinfo.rbs +9 -15
  102. data/stdlib/socket/0/socket.rbs +36 -3
  103. data/stdlib/strscan/0/string_scanner.rbs +7 -5
  104. data/stdlib/tempfile/0/tempfile.rbs +104 -44
  105. data/stdlib/time/0/time.rbs +2 -2
  106. data/stdlib/uri/0/file.rbs +5 -0
  107. data/stdlib/uri/0/generic.rbs +2 -2
  108. data/stdlib/yaml/0/yaml.rbs +2 -2
  109. data/stdlib/zlib/0/zlib.rbs +1 -1
  110. metadata +8 -6
  111. data/core/deprecated.rbs +0 -9
  112. data/sig/shims/ripper.rbs +0 -8
data/core/string_io.rbs CHANGED
@@ -1,39 +1,52 @@
1
1
  # <!-- rdoc-file=ext/stringio/stringio.c -->
2
- # Pseudo I/O on String object, with interface corresponding to IO.
2
+ # IO streams for strings, with access similar to [IO](rdoc-ref:IO); see
3
+ # [IO](rdoc-ref:IO).
3
4
  #
4
- # Commonly used to simulate `$stdio` or `$stderr`
5
+ # ### About the Examples
5
6
  #
6
- # ### Examples
7
+ # Examples on this page assume that StringIO has been required:
7
8
  #
8
9
  # require 'stringio'
9
10
  #
10
- # # Writing stream emulation
11
- # io = StringIO.new
12
- # io.puts "Hello World"
13
- # io.string #=> "Hello World\n"
14
- #
15
- # # Reading stream emulation
16
- # io = StringIO.new "first\nsecond\nlast\n"
17
- # io.getc #=> "f"
18
- # io.gets #=> "irst\n"
19
- # io.read #=> "second\nlast\n"
20
- #
21
11
  class StringIO
22
12
  # <!--
23
13
  # rdoc-file=ext/stringio/stringio.c
24
- # - StringIO.new(string=""[, mode])
14
+ # - StringIO.new(string = '', mode = 'r+') -> new_stringio
25
15
  # -->
26
- # Creates new StringIO instance from with *string* and *mode*.
16
+ # Note that `mode` defaults to `'r'` if `string` is frozen.
17
+ #
18
+ # Returns a new StringIO instance formed from `string` and `mode`; see [Access
19
+ # Modes](rdoc-ref:File@Access+Modes):
20
+ #
21
+ # strio = StringIO.new # => #<StringIO>
22
+ # strio.close
23
+ #
24
+ # The instance should be closed when no longer needed.
25
+ #
26
+ # Related: StringIO.open (accepts block; closes automatically).
27
27
  #
28
28
  def initialize: (?String string, ?String? mode) -> void
29
29
 
30
30
  # <!--
31
31
  # rdoc-file=ext/stringio/stringio.c
32
- # - StringIO.open(string=""[, mode]) {|strio| ...}
32
+ # - StringIO.open(string = '', mode = 'r+') {|strio| ... }
33
33
  # -->
34
- # Equivalent to StringIO.new except that when it is called with a block, it
35
- # yields with the new instance and closes it, and returns the result which
36
- # returned from the block.
34
+ # Note that `mode` defaults to `'r'` if `string` is frozen.
35
+ #
36
+ # Creates a new StringIO instance formed from `string` and `mode`; see [Access
37
+ # Modes](rdoc-ref:File@Access+Modes).
38
+ #
39
+ # With no block, returns the new instance:
40
+ #
41
+ # strio = StringIO.open # => #<StringIO>
42
+ #
43
+ # With a block, calls the block with the new instance and returns the block's
44
+ # value; closes the instance on block exit.
45
+ #
46
+ # StringIO.open {|strio| p strio }
47
+ # # => #<StringIO>
48
+ #
49
+ # Related: StringIO.new.
37
50
  #
38
51
  def self.open: [U] (?String string, ?String? mode) { (StringIO arg) -> U } -> U
39
52
 
@@ -41,116 +54,134 @@ class StringIO
41
54
 
42
55
  # <!--
43
56
  # rdoc-file=ext/stringio/stringio.c
44
- # - strio.binmode -> stringio
57
+ # - binmode -> self
45
58
  # -->
46
- # Puts stream into binary mode. See IO#binmode.
59
+ # Sets the data mode in `self` to binary mode; see [Data
60
+ # Mode](rdoc-ref:File@Data+Mode).
47
61
  #
48
62
  def binmode: () -> self
49
63
 
50
64
  # <!--
51
65
  # rdoc-file=ext/stringio/stringio.c
52
- # - strio.close -> nil
66
+ # - close -> nil
53
67
  # -->
54
- # Closes a StringIO. The stream is unavailable for any further data operations;
55
- # an `IOError` is raised if such an attempt is made.
68
+ # Closes `self` for both reading and writing.
69
+ #
70
+ # Raises IOError if reading or writing is attempted.
71
+ #
72
+ # Related: StringIO#close_read, StringIO#close_write.
56
73
  #
57
74
  def close: () -> nil
58
75
 
59
76
  # <!--
60
77
  # rdoc-file=ext/stringio/stringio.c
61
- # - strio.close_read -> nil
78
+ # - close_read -> nil
62
79
  # -->
63
- # Closes the read end of a StringIO. Will raise an `IOError` if the receiver is
64
- # not readable.
80
+ # Closes `self` for reading; closed-write setting remains unchanged.
81
+ #
82
+ # Raises IOError if reading is attempted.
83
+ #
84
+ # Related: StringIO#close, StringIO#close_write.
65
85
  #
66
86
  def close_read: () -> nil
67
87
 
68
88
  # <!--
69
89
  # rdoc-file=ext/stringio/stringio.c
70
- # - strio.close_write -> nil
90
+ # - close_write -> nil
71
91
  # -->
72
- # Closes the write end of a StringIO. Will raise an `IOError` if the receiver
73
- # is not writeable.
92
+ # Closes `self` for writing; closed-read setting remains unchanged.
93
+ #
94
+ # Raises IOError if writing is attempted.
95
+ #
96
+ # Related: StringIO#close, StringIO#close_read.
74
97
  #
75
98
  def close_write: () -> nil
76
99
 
77
100
  # <!--
78
101
  # rdoc-file=ext/stringio/stringio.c
79
- # - strio.closed? -> true or false
102
+ # - closed? -> true or false
80
103
  # -->
81
- # Returns `true` if the stream is completely closed, `false` otherwise.
104
+ # Returns `true` if `self` is closed for both reading and writing, `false`
105
+ # otherwise.
82
106
  #
83
107
  def closed?: () -> bool
84
108
 
85
109
  # <!--
86
110
  # rdoc-file=ext/stringio/stringio.c
87
- # - strio.closed_read? -> true or false
111
+ # - closed_read? -> true or false
88
112
  # -->
89
- # Returns `true` if the stream is not readable, `false` otherwise.
113
+ # Returns `true` if `self` is closed for reading, `false` otherwise.
90
114
  #
91
115
  def closed_read?: () -> bool
92
116
 
93
117
  # <!--
94
118
  # rdoc-file=ext/stringio/stringio.c
95
- # - strio.closed_write? -> true or false
119
+ # - closed_write? -> true or false
96
120
  # -->
97
- # Returns `true` if the stream is not writable, `false` otherwise.
121
+ # Returns `true` if `self` is closed for writing, `false` otherwise.
98
122
  #
99
123
  def closed_write?: () -> bool
100
124
 
101
125
  # <!--
102
126
  # rdoc-file=ext/stringio/stringio.c
103
- # - strio.each(sep=$/, chomp: false) {|line| block } -> strio
104
- # - strio.each(limit, chomp: false) {|line| block } -> strio
105
- # - strio.each(sep, limit, chomp: false) {|line| block } -> strio
106
- # - strio.each(...) -> anEnumerator
107
- # - strio.each_line(sep=$/, chomp: false) {|line| block } -> strio
108
- # - strio.each_line(limit, chomp: false) {|line| block } -> strio
109
- # - strio.each_line(sep, limit, chomp: false) {|line| block } -> strio
110
- # - strio.each_line(...) -> anEnumerator
127
+ # - each_line(sep = $/, chomp: false) {|line| ... } -> self
128
+ # - each_line(limit, chomp: false) {|line| ... } -> self
129
+ # - each_line(sep, limit, chomp: false) {|line| ... } -> self
111
130
  # -->
112
- # See IO#each.
131
+ # Calls the block with each remaining line read from the stream; does nothing if
132
+ # already at end-of-file; returns `self`. See [Line IO](rdoc-ref:IO@Line+IO).
133
+ #
134
+ # StringIO#each is an alias for StringIO#each_line.
113
135
  #
114
136
  def each: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
115
137
  | (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
116
138
 
117
139
  # <!--
118
140
  # rdoc-file=ext/stringio/stringio.c
119
- # - strio.each_byte {|byte| block } -> strio
120
- # - strio.each_byte -> anEnumerator
141
+ # - each_byte {|byte| ... } -> self
121
142
  # -->
122
- # See IO#each_byte.
143
+ # With a block given, calls the block with each remaining byte in the stream;
144
+ # see [Byte IO](rdoc-ref:IO@Byte+IO).
145
+ #
146
+ # With no block given, returns an enumerator.
123
147
  #
124
148
  def each_byte: () { (Integer arg0) -> untyped } -> self
125
149
  | () -> ::Enumerator[Integer, self]
126
150
 
127
151
  # <!--
128
152
  # rdoc-file=ext/stringio/stringio.c
129
- # - strio.each_char {|char| block } -> strio
130
- # - strio.each_char -> anEnumerator
153
+ # - each_char {|c| ... } -> self
131
154
  # -->
132
- # See IO#each_char.
155
+ # With a block given, calls the block with each remaining character in the
156
+ # stream; see [Character IO](rdoc-ref:IO@Character+IO).
157
+ #
158
+ # With no block given, returns an enumerator.
133
159
  #
134
160
  def each_char: () { (String arg0) -> untyped } -> self
135
161
  | () -> ::Enumerator[String, self]
136
162
 
137
163
  # <!--
138
164
  # rdoc-file=ext/stringio/stringio.c
139
- # - strio.each_codepoint {|c| block } -> strio
140
- # - strio.each_codepoint -> anEnumerator
165
+ # - each_codepoint {|codepoint| ... } -> self
141
166
  # -->
142
- # See IO#each_codepoint.
167
+ # With a block given, calls the block with each remaining codepoint in the
168
+ # stream; see [Codepoint IO](rdoc-ref:IO@Codepoint+IO).
169
+ #
170
+ # With no block given, returns an enumerator.
143
171
  #
144
172
  def each_codepoint: () { (Integer arg0) -> untyped } -> self
145
173
  | () -> ::Enumerator[Integer, self]
146
174
 
147
175
  # <!--
148
176
  # rdoc-file=ext/stringio/stringio.c
149
- # - strio.eof -> true or false
150
- # - strio.eof? -> true or false
177
+ # - eof? -> true or false
151
178
  # -->
152
- # Returns true if the stream is at the end of the data (underlying string). The
153
- # stream must be opened for reading or an `IOError` will be raised.
179
+ # Returns `true` if positioned at end-of-stream, `false` otherwise; see
180
+ # [Position](rdoc-ref:File@Position).
181
+ #
182
+ # Raises IOError if the stream is not opened for reading.
183
+ #
184
+ # StreamIO#eof is an alias for StreamIO#eof?.
154
185
  #
155
186
  def eof: () -> bool
156
187
 
@@ -188,27 +219,30 @@ class StringIO
188
219
 
189
220
  # <!--
190
221
  # rdoc-file=ext/stringio/stringio.c
191
- # - strio.getbyte -> fixnum or nil
222
+ # - getbyte -> byte or nil
192
223
  # -->
193
- # See IO#getbyte.
224
+ # Reads and returns the next 8-bit byte from the stream; see [Byte
225
+ # IO](rdoc-ref:IO@Byte+IO).
194
226
  #
195
227
  def getbyte: () -> Integer?
196
228
 
197
229
  # <!--
198
230
  # rdoc-file=ext/stringio/stringio.c
199
- # - strio.getc -> string or nil
231
+ # - getc -> character or nil
200
232
  # -->
201
- # See IO#getc.
233
+ # Reads and returns the next character from the stream; see [Character
234
+ # IO](rdoc-ref:IO@Character+IO).
202
235
  #
203
236
  def getc: () -> String?
204
237
 
205
238
  # <!--
206
239
  # rdoc-file=ext/stringio/stringio.c
207
- # - strio.gets(sep=$/, chomp: false) -> string or nil
208
- # - strio.gets(limit, chomp: false) -> string or nil
209
- # - strio.gets(sep, limit, chomp: false) -> string or nil
240
+ # - gets(sep = $/, chomp: false) -> string or nil
241
+ # - gets(limit, chomp: false) -> string or nil
242
+ # - gets(sep, limit, chomp: false) -> string or nil
210
243
  # -->
211
- # See IO#gets.
244
+ # Reads and returns a line from the stream; assigns the return value to `$_`;
245
+ # see [Line IO](rdoc-ref:IO@Line+IO).
212
246
  #
213
247
  def gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
214
248
 
@@ -240,21 +274,19 @@ class StringIO
240
274
 
241
275
  # <!--
242
276
  # rdoc-file=ext/stringio/stringio.c
243
- # - strio.lineno -> integer
277
+ # - lineno -> current_line_number
244
278
  # -->
245
- # Returns the current line number. The stream must be opened for reading.
246
- # `lineno` counts the number of times `gets` is called, rather than the number
247
- # of newlines encountered. The two values will differ if `gets` is called with
248
- # a separator other than newline. See also the `$.` variable.
279
+ # Returns the current line number in `self`; see [Line
280
+ # Number](rdoc-ref:IO@Line+Number).
249
281
  #
250
282
  def lineno: () -> Integer
251
283
 
252
284
  # <!--
253
285
  # rdoc-file=ext/stringio/stringio.c
254
- # - strio.lineno = integer -> integer
286
+ # - lineno = new_line_number -> new_line_number
255
287
  # -->
256
- # Manually sets the current line number to the given value. `$.` is updated only
257
- # on the next read.
288
+ # Sets the current line number in `self` to the given `new_line_number`; see
289
+ # [Line Number](rdoc-ref:IO@Line+Number).
258
290
  #
259
291
  def lineno=: (Integer arg0) -> Integer
260
292
 
@@ -268,18 +300,19 @@ class StringIO
268
300
 
269
301
  # <!--
270
302
  # rdoc-file=ext/stringio/stringio.c
271
- # - strio.pos -> integer
272
- # - strio.tell -> integer
303
+ # - pos -> stream_position
273
304
  # -->
274
- # Returns the current offset (in bytes).
305
+ # Returns the current position (in bytes); see [Position](rdoc-ref:IO@Position).
306
+ #
307
+ # StringIO#tell is an alias for StringIO#pos.
275
308
  #
276
309
  def pos: () -> Integer
277
310
 
278
311
  # <!--
279
312
  # rdoc-file=ext/stringio/stringio.c
280
- # - strio.pos = integer -> integer
313
+ # - pos = new_position -> new_position
281
314
  # -->
282
- # Seeks to the given position (in bytes).
315
+ # Sets the current position (in bytes); see [Position](rdoc-ref:IO@Position).
283
316
  #
284
317
  def pos=: (Integer arg0) -> Integer
285
318
 
@@ -327,29 +360,45 @@ class StringIO
327
360
 
328
361
  # <!--
329
362
  # rdoc-file=ext/stringio/stringio.c
330
- # - strio.reopen(other_StrIO) -> strio
331
- # - strio.reopen(string, mode) -> strio
363
+ # - reopen(other, mode = 'r+') -> self
332
364
  # -->
333
- # Reinitializes the stream with the given *other_StrIO* or *string* and *mode*
334
- # (see StringIO#new).
365
+ # Reinitializes the stream with the given `other` (string or StringIO) and
366
+ # `mode`; see IO.new:
367
+ #
368
+ # StringIO.open('foo') do |strio|
369
+ # p strio.string
370
+ # strio.reopen('bar')
371
+ # p strio.string
372
+ # other_strio = StringIO.new('baz')
373
+ # strio.reopen(other_strio)
374
+ # p strio.string
375
+ # other_strio.close
376
+ # end
377
+ #
378
+ # Output:
379
+ #
380
+ # "foo"
381
+ # "bar"
382
+ # "baz"
335
383
  #
336
384
  def reopen: (StringIO other) -> self
337
385
  | (String other, ?String mode_str) -> self
338
386
 
339
387
  # <!--
340
388
  # rdoc-file=ext/stringio/stringio.c
341
- # - strio.rewind -> 0
389
+ # - rewind -> 0
342
390
  # -->
343
- # Positions the stream to the beginning of input, resetting `lineno` to zero.
391
+ # Sets the current position and line number to zero; see
392
+ # [Position](rdoc-ref:IO@Position) and [Line Number](rdoc-ref:IO@Line+Number).
344
393
  #
345
394
  def rewind: () -> Integer
346
395
 
347
396
  # <!--
348
397
  # rdoc-file=ext/stringio/stringio.c
349
- # - strio.seek(amount, whence=SEEK_SET) -> 0
398
+ # - seek(offset, whence = SEEK_SET) -> 0
350
399
  # -->
351
- # Seeks to a given offset *amount* in the stream according to the value of
352
- # *whence* (see IO#seek).
400
+ # Sets the current position to the given integer `offset` (in bytes), with
401
+ # respect to a given constant `whence`; see [Position](rdoc-ref:IO@Position).
353
402
  #
354
403
  def seek: (Integer amount, ?Integer whence) -> Integer
355
404
 
@@ -366,17 +415,44 @@ class StringIO
366
415
 
367
416
  # <!--
368
417
  # rdoc-file=ext/stringio/stringio.c
369
- # - strio.string -> string
418
+ # - string -> string
370
419
  # -->
371
- # Returns underlying String object, the subject of IO.
420
+ # Returns underlying string:
421
+ #
422
+ # StringIO.open('foo') do |strio|
423
+ # p strio.string
424
+ # strio.string = 'bar'
425
+ # p strio.string
426
+ # end
427
+ #
428
+ # Output:
429
+ #
430
+ # "foo"
431
+ # "bar"
432
+ #
433
+ # Related: StringIO#string= (assigns the underlying string).
372
434
  #
373
435
  def string: () -> String
374
436
 
375
437
  # <!--
376
438
  # rdoc-file=ext/stringio/stringio.c
377
- # - strio.string = string -> string
439
+ # - string = other_string -> other_string
378
440
  # -->
379
- # Changes underlying String object, the subject of IO.
441
+ # Assigns the underlying string as `other_string`, and sets position to zero;
442
+ # returns `other_string`:
443
+ #
444
+ # StringIO.open('foo') do |strio|
445
+ # p strio.string
446
+ # strio.string = 'bar'
447
+ # p strio.string
448
+ # end
449
+ #
450
+ # Output:
451
+ #
452
+ # "foo"
453
+ # "bar"
454
+ #
455
+ # Related: StringIO#string (returns the underlying string).
380
456
  #
381
457
  def string=: (String str) -> String
382
458
 
@@ -391,9 +467,9 @@ class StringIO
391
467
 
392
468
  # <!--
393
469
  # rdoc-file=ext/stringio/stringio.c
394
- # - strio.sync -> true
470
+ # - sync -> true
395
471
  # -->
396
- # Returns `true` always.
472
+ # Returns `true`; implemented only for compatibility with other stream classes.
397
473
  #
398
474
  def sync: () -> bool
399
475
 
@@ -411,10 +487,11 @@ class StringIO
411
487
 
412
488
  # <!--
413
489
  # rdoc-file=ext/stringio/stringio.c
414
- # - strio.pos -> integer
415
- # - strio.tell -> integer
490
+ # - pos -> stream_position
416
491
  # -->
417
- # Returns the current offset (in bytes).
492
+ # Returns the current position (in bytes); see [Position](rdoc-ref:IO@Position).
493
+ #
494
+ # StringIO#tell is an alias for StringIO#pos.
418
495
  #
419
496
  def tell: () -> Integer
420
497
 
@@ -425,19 +502,19 @@ class StringIO
425
502
 
426
503
  # <!--
427
504
  # rdoc-file=ext/stringio/stringio.c
428
- # - strio.ungetbyte(fixnum) -> nil
505
+ # - ungetbyte(byte) -> nil
429
506
  # -->
430
- # See IO#ungetbyte
507
+ # Pushes back ("unshifts") an 8-bit byte onto the stream; see [Byte
508
+ # IO](rdoc-ref:IO@Byte+IO).
431
509
  #
432
510
  def ungetbyte: (String | Integer arg0) -> nil
433
511
 
434
512
  # <!--
435
513
  # rdoc-file=ext/stringio/stringio.c
436
- # - strio.ungetc(string) -> nil
514
+ # - ungetc(character) -> nil
437
515
  # -->
438
- # Pushes back one character (passed as a parameter) such that a subsequent
439
- # buffered read will return it. There is no limitation for multiple pushbacks
440
- # including pushing back behind the beginning of the buffer string.
516
+ # Pushes back ("unshifts") a character or integer onto the stream; see
517
+ # [Character IO](rdoc-ref:IO@Character+IO).
441
518
  #
442
519
  def ungetc: (String arg0) -> nil
443
520
 
@@ -468,14 +545,21 @@ class StringIO
468
545
  | () -> ::Enumerator[Integer, self]
469
546
 
470
547
  # <!-- rdoc-file=ext/stringio/stringio.c -->
471
- # See IO#each.
548
+ # Calls the block with each remaining line read from the stream; does nothing if
549
+ # already at end-of-file; returns `self`. See [Line IO](rdoc-ref:IO@Line+IO).
550
+ #
551
+ # StringIO#each is an alias for StringIO#each_line.
472
552
  #
473
553
  def each_line: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
474
554
  | (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
475
555
 
476
556
  # <!-- rdoc-file=ext/stringio/stringio.c -->
477
- # Returns true if the stream is at the end of the data (underlying string). The
478
- # stream must be opened for reading or an `IOError` will be raised.
557
+ # Returns `true` if positioned at end-of-stream, `false` otherwise; see
558
+ # [Position](rdoc-ref:File@Position).
559
+ #
560
+ # Raises IOError if the stream is not opened for reading.
561
+ #
562
+ # StreamIO#eof is an alias for StreamIO#eof?.
479
563
  #
480
564
  def eof?: () -> bool
481
565