rbs 2.0.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/comments.yml +34 -0
- data/.github/workflows/ruby.yml +5 -0
- data/CHANGELOG.md +82 -0
- data/README.md +6 -1
- data/Rakefile +56 -21
- data/core/array.rbs +2866 -1086
- data/core/basic_object.rbs +150 -30
- data/core/binding.rbs +33 -0
- data/core/builtin.rbs +4 -4
- data/core/class.rbs +43 -5
- data/core/comparable.rbs +57 -0
- data/core/complex.rbs +170 -4
- data/core/constants.rbs +51 -0
- data/core/deprecated.rbs +7 -0
- data/core/dir.rbs +305 -20
- data/core/encoding.rbs +1214 -77
- data/core/enumerable.rbs +2173 -234
- data/core/enumerator.rbs +448 -182
- data/core/env.rbs +448 -1
- data/core/errno.rbs +1 -10
- data/core/errors.rbs +152 -2
- data/core/exception.rbs +201 -127
- data/core/false_class.rbs +27 -0
- data/core/fiber.rbs +118 -37
- data/core/fiber_error.rbs +8 -9
- data/core/file.rbs +1060 -142
- data/core/file_test.rbs +287 -32
- data/core/float.rbs +776 -300
- data/core/gc.rbs +185 -34
- data/core/global_variables.rbs +5 -1
- data/core/hash.rbs +1582 -649
- data/core/integer.rbs +974 -204
- data/core/io/buffer.rbs +710 -0
- data/core/io/wait.rbs +29 -8
- data/core/io.rbs +2438 -417
- data/core/kernel.rbs +2319 -318
- data/core/marshal.rbs +37 -2
- data/core/match_data.rbs +123 -6
- data/core/math.rbs +126 -6
- data/core/method.rbs +226 -102
- data/core/module.rbs +421 -45
- data/core/nil_class.rbs +64 -0
- data/core/numeric.rbs +620 -142
- data/core/object.rbs +453 -81
- data/core/object_space.rbs +92 -2
- data/core/proc.rbs +482 -285
- data/core/process.rbs +443 -34
- data/core/ractor.rbs +232 -9
- data/core/random.rbs +151 -52
- data/core/range.rbs +885 -160
- data/core/rational.rbs +122 -6
- data/core/rb_config.rbs +14 -4
- data/core/refinement.rbs +44 -0
- data/core/regexp.rbs +156 -14
- data/core/ruby_vm.rbs +42 -3
- data/core/signal.rbs +78 -39
- data/core/string.rbs +2123 -567
- data/core/string_io.rbs +204 -0
- data/core/struct.rbs +283 -28
- data/core/symbol.rbs +304 -30
- data/core/thread.rbs +1288 -688
- data/core/thread_group.rbs +66 -10
- data/core/time.rbs +643 -217
- data/core/trace_point.rbs +100 -12
- data/core/true_class.rbs +24 -0
- data/core/unbound_method.rbs +73 -7
- data/core/warning.rbs +37 -12
- data/docs/CONTRIBUTING.md +40 -34
- data/docs/stdlib.md +3 -102
- data/docs/syntax.md +54 -11
- data/ext/rbs_extension/extconf.rb +1 -0
- data/ext/rbs_extension/lexer.h +5 -0
- data/ext/rbs_extension/lexstate.c +6 -0
- data/ext/rbs_extension/parser.c +85 -10
- data/ext/rbs_extension/ruby_objs.c +4 -2
- data/ext/rbs_extension/ruby_objs.h +2 -2
- data/goodcheck.yml +0 -11
- data/lib/rbs/annotate/annotations.rb +197 -0
- data/lib/rbs/annotate/formatter.rb +80 -0
- data/lib/rbs/annotate/rdoc_annotator.rb +398 -0
- data/lib/rbs/annotate/rdoc_source.rb +120 -0
- data/lib/rbs/annotate.rb +6 -0
- data/lib/rbs/ast/members.rb +21 -13
- data/lib/rbs/buffer.rb +17 -11
- data/lib/rbs/cli.rb +48 -1
- data/lib/rbs/definition_builder/method_builder.rb +28 -16
- data/lib/rbs/definition_builder.rb +6 -2
- data/lib/rbs/environment.rb +8 -4
- data/lib/rbs/location_aux.rb +12 -0
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/prototype/rb.rb +12 -0
- data/lib/rbs/type_alias_regularity.rb +6 -4
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/types.rb +1 -1
- data/lib/rbs/validator.rb +6 -0
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +54 -4
- data/lib/rbs.rb +0 -2
- data/schema/typeParam.json +3 -3
- data/sig/annotate/annotations.rbs +102 -0
- data/sig/annotate/formatter.rbs +24 -0
- data/sig/annotate/rdoc_annotater.rbs +82 -0
- data/sig/annotate/rdoc_source.rbs +30 -0
- data/sig/buffer.rbs +6 -2
- data/sig/cli.rbs +2 -0
- data/sig/collection/{collections.rbs → sources.rbs} +0 -0
- data/sig/location.rbs +6 -0
- data/sig/members.rbs +24 -18
- data/sig/method_builder.rbs +5 -4
- data/sig/method_types.rbs +5 -1
- data/sig/polyfill.rbs +78 -0
- data/sig/validator.rbs +3 -1
- data/sig/writer.rbs +79 -2
- data/stdlib/abbrev/0/abbrev.rbs +6 -0
- data/stdlib/abbrev/0/array.rbs +26 -0
- data/stdlib/base64/0/base64.rbs +31 -0
- data/stdlib/benchmark/0/benchmark.rbs +74 -3
- data/stdlib/bigdecimal/0/big_decimal.rbs +614 -165
- data/stdlib/bigdecimal-math/0/big_math.rbs +41 -64
- data/stdlib/cgi/0/core.rbs +649 -21
- data/stdlib/coverage/0/coverage.rbs +164 -2
- data/stdlib/csv/0/csv.rbs +2862 -398
- data/stdlib/date/0/date.rbs +483 -25
- data/stdlib/date/0/date_time.rbs +187 -12
- data/stdlib/dbm/0/dbm.rbs +152 -17
- data/stdlib/digest/0/digest.rbs +146 -0
- data/stdlib/erb/0/erb.rbs +65 -245
- data/stdlib/fiber/0/fiber.rbs +73 -91
- data/stdlib/fileutils/0/fileutils.rbs +301 -1
- data/stdlib/find/0/find.rbs +9 -0
- data/stdlib/forwardable/0/forwardable.rbs +65 -1
- data/stdlib/io-console/0/io-console.rbs +227 -15
- data/stdlib/ipaddr/0/ipaddr.rbs +161 -0
- data/stdlib/json/0/json.rbs +1147 -145
- data/stdlib/logger/0/formatter.rbs +24 -0
- data/stdlib/logger/0/log_device.rbs +64 -0
- data/stdlib/logger/0/logger.rbs +165 -13
- data/stdlib/logger/0/period.rbs +10 -0
- data/stdlib/logger/0/severity.rbs +26 -0
- data/stdlib/monitor/0/monitor.rbs +163 -0
- data/stdlib/mutex_m/0/mutex_m.rbs +35 -6
- data/stdlib/net-http/0/manifest.yaml +1 -0
- data/stdlib/net-http/0/net-http.rbs +1513 -683
- data/stdlib/nkf/0/nkf.rbs +372 -0
- data/stdlib/objspace/0/objspace.rbs +149 -90
- data/stdlib/openssl/0/openssl.rbs +8108 -71
- data/stdlib/optparse/0/optparse.rbs +487 -19
- data/stdlib/pathname/0/pathname.rbs +425 -124
- data/stdlib/prettyprint/0/prettyprint.rbs +120 -99
- data/stdlib/prime/0/integer-extension.rbs +20 -2
- data/stdlib/prime/0/prime.rbs +88 -21
- data/stdlib/pstore/0/pstore.rbs +102 -0
- data/stdlib/pty/0/pty.rbs +64 -14
- data/stdlib/resolv/0/resolv.rbs +420 -31
- data/stdlib/rubygems/0/basic_specification.rbs +4 -1
- data/stdlib/rubygems/0/config_file.rbs +33 -1
- data/stdlib/rubygems/0/dependency_installer.rbs +4 -3
- data/stdlib/rubygems/0/installer.rbs +13 -1
- data/stdlib/rubygems/0/path_support.rbs +4 -1
- data/stdlib/rubygems/0/platform.rbs +5 -1
- data/stdlib/rubygems/0/request_set.rbs +44 -2
- data/stdlib/rubygems/0/requirement.rbs +65 -2
- data/stdlib/rubygems/0/rubygems.rbs +407 -0
- data/stdlib/rubygems/0/source_list.rbs +13 -0
- data/stdlib/rubygems/0/specification.rbs +21 -1
- data/stdlib/rubygems/0/stream_ui.rbs +3 -1
- data/stdlib/rubygems/0/uninstaller.rbs +8 -1
- data/stdlib/rubygems/0/version.rbs +60 -157
- data/stdlib/securerandom/0/securerandom.rbs +44 -0
- data/stdlib/set/0/set.rbs +423 -109
- data/stdlib/shellwords/0/shellwords.rbs +55 -77
- data/stdlib/singleton/0/singleton.rbs +20 -0
- data/stdlib/socket/0/addrinfo.rbs +210 -9
- data/stdlib/socket/0/basic_socket.rbs +103 -11
- data/stdlib/socket/0/ip_socket.rbs +31 -9
- data/stdlib/socket/0/socket.rbs +586 -38
- data/stdlib/socket/0/tcp_server.rbs +22 -2
- data/stdlib/socket/0/tcp_socket.rbs +12 -1
- data/stdlib/socket/0/udp_socket.rbs +25 -2
- data/stdlib/socket/0/unix_server.rbs +22 -2
- data/stdlib/socket/0/unix_socket.rbs +45 -5
- data/stdlib/strscan/0/string_scanner.rbs +210 -9
- data/stdlib/tempfile/0/tempfile.rbs +58 -10
- data/stdlib/time/0/time.rbs +208 -116
- data/stdlib/timeout/0/timeout.rbs +10 -0
- data/stdlib/tmpdir/0/tmpdir.rbs +13 -4
- data/stdlib/tsort/0/cyclic.rbs +1 -0
- data/stdlib/tsort/0/interfaces.rbs +1 -0
- data/stdlib/tsort/0/tsort.rbs +42 -0
- data/stdlib/uri/0/common.rbs +57 -8
- data/stdlib/uri/0/file.rbs +55 -109
- data/stdlib/uri/0/ftp.rbs +6 -3
- data/stdlib/uri/0/generic.rbs +558 -329
- data/stdlib/uri/0/http.rbs +60 -114
- data/stdlib/uri/0/https.rbs +8 -102
- data/stdlib/uri/0/ldap.rbs +143 -137
- data/stdlib/uri/0/ldaps.rbs +8 -102
- data/stdlib/uri/0/mailto.rbs +3 -0
- data/stdlib/uri/0/rfc2396_parser.rbs +66 -26
- data/stdlib/uri/0/ws.rbs +6 -3
- data/stdlib/uri/0/wss.rbs +5 -3
- data/stdlib/yaml/0/dbm.rbs +151 -87
- data/stdlib/yaml/0/store.rbs +6 -0
- data/stdlib/zlib/0/zlib.rbs +90 -31
- metadata +18 -6
- data/lib/rbs/location.rb +0 -221
- data/sig/char_scanner.rbs +0 -9
data/core/string_io.rbs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=ext/stringio/stringio.c -->
|
|
1
2
|
# Pseudo I/O on String object, with interface corresponding to IO.
|
|
2
3
|
#
|
|
3
4
|
# Commonly used to simulate `$stdio` or `$stderr`
|
|
@@ -18,10 +19,18 @@
|
|
|
18
19
|
# io.read #=> "second\nlast\n"
|
|
19
20
|
#
|
|
20
21
|
class StringIO
|
|
22
|
+
# <!--
|
|
23
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
24
|
+
# - StringIO.new(string=""[, mode])
|
|
25
|
+
# -->
|
|
21
26
|
# Creates new StringIO instance from with *string* and *mode*.
|
|
22
27
|
#
|
|
23
28
|
def initialize: (?String string, ?String? mode) -> void
|
|
24
29
|
|
|
30
|
+
# <!--
|
|
31
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
32
|
+
# - StringIO.open(string=""[, mode]) {|strio| ...}
|
|
33
|
+
# -->
|
|
25
34
|
# Equivalent to StringIO.new except that when it is called with a block, it
|
|
26
35
|
# yields with the new instance and closes it, and returns the result which
|
|
27
36
|
# returned from the block.
|
|
@@ -30,104 +39,209 @@ class StringIO
|
|
|
30
39
|
|
|
31
40
|
def <<: (untyped arg0) -> self
|
|
32
41
|
|
|
42
|
+
# <!--
|
|
43
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
44
|
+
# - strio.binmode -> stringio
|
|
45
|
+
# -->
|
|
33
46
|
# Puts stream into binary mode. See IO#binmode.
|
|
34
47
|
#
|
|
35
48
|
def binmode: () -> self
|
|
36
49
|
|
|
50
|
+
# <!--
|
|
51
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
52
|
+
# - strio.close -> nil
|
|
53
|
+
# -->
|
|
37
54
|
# Closes a StringIO. The stream is unavailable for any further data operations;
|
|
38
55
|
# an `IOError` is raised if such an attempt is made.
|
|
39
56
|
#
|
|
40
57
|
def close: () -> nil
|
|
41
58
|
|
|
59
|
+
# <!--
|
|
60
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
61
|
+
# - strio.close_read -> nil
|
|
62
|
+
# -->
|
|
42
63
|
# Closes the read end of a StringIO. Will raise an `IOError` if the receiver is
|
|
43
64
|
# not readable.
|
|
44
65
|
#
|
|
45
66
|
def close_read: () -> nil
|
|
46
67
|
|
|
68
|
+
# <!--
|
|
69
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
70
|
+
# - strio.close_write -> nil
|
|
71
|
+
# -->
|
|
47
72
|
# Closes the write end of a StringIO. Will raise an `IOError` if the receiver
|
|
48
73
|
# is not writeable.
|
|
49
74
|
#
|
|
50
75
|
def close_write: () -> nil
|
|
51
76
|
|
|
77
|
+
# <!--
|
|
78
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
79
|
+
# - strio.closed? -> true or false
|
|
80
|
+
# -->
|
|
52
81
|
# Returns `true` if the stream is completely closed, `false` otherwise.
|
|
53
82
|
#
|
|
54
83
|
def closed?: () -> bool
|
|
55
84
|
|
|
85
|
+
# <!--
|
|
86
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
87
|
+
# - strio.closed_read? -> true or false
|
|
88
|
+
# -->
|
|
56
89
|
# Returns `true` if the stream is not readable, `false` otherwise.
|
|
57
90
|
#
|
|
58
91
|
def closed_read?: () -> bool
|
|
59
92
|
|
|
93
|
+
# <!--
|
|
94
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
95
|
+
# - strio.closed_write? -> true or false
|
|
96
|
+
# -->
|
|
60
97
|
# Returns `true` if the stream is not writable, `false` otherwise.
|
|
61
98
|
#
|
|
62
99
|
def closed_write?: () -> bool
|
|
63
100
|
|
|
101
|
+
# <!--
|
|
102
|
+
# 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
|
|
111
|
+
# -->
|
|
64
112
|
# See IO#each.
|
|
65
113
|
#
|
|
66
114
|
def each: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
|
|
67
115
|
| (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
|
|
68
116
|
|
|
117
|
+
# <!--
|
|
118
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
119
|
+
# - strio.each_byte {|byte| block } -> strio
|
|
120
|
+
# - strio.each_byte -> anEnumerator
|
|
121
|
+
# -->
|
|
69
122
|
# See IO#each_byte.
|
|
70
123
|
#
|
|
71
124
|
def each_byte: () { (Integer arg0) -> untyped } -> self
|
|
72
125
|
| () -> ::Enumerator[Integer, self]
|
|
73
126
|
|
|
127
|
+
# <!--
|
|
128
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
129
|
+
# - strio.each_char {|char| block } -> strio
|
|
130
|
+
# - strio.each_char -> anEnumerator
|
|
131
|
+
# -->
|
|
74
132
|
# See IO#each_char.
|
|
75
133
|
#
|
|
76
134
|
def each_char: () { (String arg0) -> untyped } -> self
|
|
77
135
|
| () -> ::Enumerator[String, self]
|
|
78
136
|
|
|
137
|
+
# <!--
|
|
138
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
139
|
+
# - strio.each_codepoint {|c| block } -> strio
|
|
140
|
+
# - strio.each_codepoint -> anEnumerator
|
|
141
|
+
# -->
|
|
79
142
|
# See IO#each_codepoint.
|
|
80
143
|
#
|
|
81
144
|
def each_codepoint: () { (Integer arg0) -> untyped } -> self
|
|
82
145
|
| () -> ::Enumerator[Integer, self]
|
|
83
146
|
|
|
147
|
+
# <!--
|
|
148
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
149
|
+
# - strio.eof -> true or false
|
|
150
|
+
# - strio.eof? -> true or false
|
|
151
|
+
# -->
|
|
84
152
|
# Returns true if the stream is at the end of the data (underlying string). The
|
|
85
153
|
# stream must be opened for reading or an `IOError` will be raised.
|
|
86
154
|
#
|
|
87
155
|
def eof: () -> bool
|
|
88
156
|
|
|
157
|
+
# <!--
|
|
158
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
159
|
+
# - fcntl(*args)
|
|
160
|
+
# -->
|
|
89
161
|
# Raises NotImplementedError.
|
|
90
162
|
#
|
|
91
163
|
def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
|
|
92
164
|
|
|
165
|
+
# <!--
|
|
166
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
167
|
+
# - fileno()
|
|
168
|
+
# -->
|
|
93
169
|
# Returns `nil`. Just for compatibility to IO.
|
|
94
170
|
#
|
|
95
171
|
def fileno: () -> nil
|
|
96
172
|
|
|
173
|
+
# <!--
|
|
174
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
175
|
+
# - flush()
|
|
176
|
+
# -->
|
|
97
177
|
# Returns an object itself. Just for compatibility to IO.
|
|
98
178
|
#
|
|
99
179
|
def flush: () -> self
|
|
100
180
|
|
|
181
|
+
# <!--
|
|
182
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
183
|
+
# - fsync()
|
|
184
|
+
# -->
|
|
101
185
|
# Returns 0. Just for compatibility to IO.
|
|
102
186
|
#
|
|
103
187
|
def fsync: () -> Integer?
|
|
104
188
|
|
|
189
|
+
# <!--
|
|
190
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
191
|
+
# - strio.getbyte -> fixnum or nil
|
|
192
|
+
# -->
|
|
105
193
|
# See IO#getbyte.
|
|
106
194
|
#
|
|
107
195
|
def getbyte: () -> Integer?
|
|
108
196
|
|
|
197
|
+
# <!--
|
|
198
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
199
|
+
# - strio.getc -> string or nil
|
|
200
|
+
# -->
|
|
109
201
|
# See IO#getc.
|
|
110
202
|
#
|
|
111
203
|
def getc: () -> String?
|
|
112
204
|
|
|
205
|
+
# <!--
|
|
206
|
+
# 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
|
|
210
|
+
# -->
|
|
113
211
|
# See IO#gets.
|
|
114
212
|
#
|
|
115
213
|
def gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
|
|
116
214
|
|
|
215
|
+
# <!--
|
|
216
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
217
|
+
# - strio.internal_encoding => encoding
|
|
218
|
+
# -->
|
|
117
219
|
# Returns the Encoding of the internal string if conversion is specified.
|
|
118
220
|
# Otherwise returns `nil`.
|
|
119
221
|
#
|
|
120
222
|
def internal_encoding: () -> Encoding
|
|
121
223
|
|
|
224
|
+
# <!--
|
|
225
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
226
|
+
# - strio.external_encoding => encoding
|
|
227
|
+
# -->
|
|
122
228
|
# Returns the Encoding object that represents the encoding of the file. If the
|
|
123
229
|
# stream is write mode and no encoding is specified, returns `nil`.
|
|
124
230
|
#
|
|
125
231
|
def external_encoding: () -> Encoding
|
|
126
232
|
|
|
233
|
+
# <!--
|
|
234
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
235
|
+
# - isatty()
|
|
236
|
+
# -->
|
|
127
237
|
# Returns `false`. Just for compatibility to IO.
|
|
128
238
|
#
|
|
129
239
|
def isatty: () -> bool
|
|
130
240
|
|
|
241
|
+
# <!--
|
|
242
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
243
|
+
# - strio.lineno -> integer
|
|
244
|
+
# -->
|
|
131
245
|
# Returns the current line number. The stream must be opened for reading.
|
|
132
246
|
# `lineno` counts the number of times `gets` is called, rather than the number
|
|
133
247
|
# of newlines encountered. The two values will differ if `gets` is called with
|
|
@@ -135,19 +249,36 @@ class StringIO
|
|
|
135
249
|
#
|
|
136
250
|
def lineno: () -> Integer
|
|
137
251
|
|
|
252
|
+
# <!--
|
|
253
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
254
|
+
# - strio.lineno = integer -> integer
|
|
255
|
+
# -->
|
|
138
256
|
# Manually sets the current line number to the given value. `$.` is updated only
|
|
139
257
|
# on the next read.
|
|
140
258
|
#
|
|
141
259
|
def lineno=: (Integer arg0) -> Integer
|
|
142
260
|
|
|
261
|
+
# <!--
|
|
262
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
263
|
+
# - pid()
|
|
264
|
+
# -->
|
|
143
265
|
# Returns `nil`. Just for compatibility to IO.
|
|
144
266
|
#
|
|
145
267
|
def pid: () -> nil
|
|
146
268
|
|
|
269
|
+
# <!--
|
|
270
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
271
|
+
# - strio.pos -> integer
|
|
272
|
+
# - strio.tell -> integer
|
|
273
|
+
# -->
|
|
147
274
|
# Returns the current offset (in bytes).
|
|
148
275
|
#
|
|
149
276
|
def pos: () -> Integer
|
|
150
277
|
|
|
278
|
+
# <!--
|
|
279
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
280
|
+
# - strio.pos = integer -> integer
|
|
281
|
+
# -->
|
|
151
282
|
# Seeks to the given position (in bytes).
|
|
152
283
|
#
|
|
153
284
|
def pos=: (Integer arg0) -> Integer
|
|
@@ -156,12 +287,20 @@ class StringIO
|
|
|
156
287
|
|
|
157
288
|
def printf: (String format_string, *untyped arg0) -> nil
|
|
158
289
|
|
|
290
|
+
# <!--
|
|
291
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
292
|
+
# - strio.putc(obj) -> obj
|
|
293
|
+
# -->
|
|
159
294
|
# See IO#putc.
|
|
160
295
|
#
|
|
161
296
|
def putc: (Numeric | String arg0) -> untyped
|
|
162
297
|
|
|
163
298
|
def puts: (*untyped arg0) -> nil
|
|
164
299
|
|
|
300
|
+
# <!--
|
|
301
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
302
|
+
# - strio.read([length [, outbuf]]) -> string, outbuf, or nil
|
|
303
|
+
# -->
|
|
165
304
|
# See IO#read.
|
|
166
305
|
#
|
|
167
306
|
def read: (?int? length, ?string outbuf) -> String?
|
|
@@ -174,27 +313,50 @@ class StringIO
|
|
|
174
313
|
|
|
175
314
|
def readline: (?String sep, ?Integer limit) -> String
|
|
176
315
|
|
|
316
|
+
# <!--
|
|
317
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
318
|
+
# - strio.readlines(sep=$/, chomp: false) -> array
|
|
319
|
+
# - strio.readlines(limit, chomp: false) -> array
|
|
320
|
+
# - strio.readlines(sep, limit, chomp: false) -> array
|
|
321
|
+
# -->
|
|
177
322
|
# See IO#readlines.
|
|
178
323
|
#
|
|
179
324
|
def readlines: (?String sep, ?Integer limit, ?chomp: boolish) -> ::Array[String]
|
|
180
325
|
|
|
181
326
|
def readpartial: (int maxlen, ?string outbuf) -> String
|
|
182
327
|
|
|
328
|
+
# <!--
|
|
329
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
330
|
+
# - strio.reopen(other_StrIO) -> strio
|
|
331
|
+
# - strio.reopen(string, mode) -> strio
|
|
332
|
+
# -->
|
|
183
333
|
# Reinitializes the stream with the given *other_StrIO* or *string* and *mode*
|
|
184
334
|
# (see StringIO#new).
|
|
185
335
|
#
|
|
186
336
|
def reopen: (StringIO other) -> self
|
|
187
337
|
| (String other, ?String mode_str) -> self
|
|
188
338
|
|
|
339
|
+
# <!--
|
|
340
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
341
|
+
# - strio.rewind -> 0
|
|
342
|
+
# -->
|
|
189
343
|
# Positions the stream to the beginning of input, resetting `lineno` to zero.
|
|
190
344
|
#
|
|
191
345
|
def rewind: () -> Integer
|
|
192
346
|
|
|
347
|
+
# <!--
|
|
348
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
349
|
+
# - strio.seek(amount, whence=SEEK_SET) -> 0
|
|
350
|
+
# -->
|
|
193
351
|
# Seeks to a given offset *amount* in the stream according to the value of
|
|
194
352
|
# *whence* (see IO#seek).
|
|
195
353
|
#
|
|
196
354
|
def seek: (Integer amount, ?Integer whence) -> Integer
|
|
197
355
|
|
|
356
|
+
# <!--
|
|
357
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
358
|
+
# - strio.set_encoding(ext_enc, [int_enc[, opt]]) => strio
|
|
359
|
+
# -->
|
|
198
360
|
# Specify the encoding of the StringIO as *ext_enc*. Use the default external
|
|
199
361
|
# encoding if *ext_enc* is nil. 2nd argument *int_enc* and optional hash *opt*
|
|
200
362
|
# argument are ignored; they are for API compatibility to IO.
|
|
@@ -202,22 +364,43 @@ class StringIO
|
|
|
202
364
|
def set_encoding: (?String | Encoding ext_or_ext_int_enc) -> self
|
|
203
365
|
| (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
|
|
204
366
|
|
|
367
|
+
# <!--
|
|
368
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
369
|
+
# - strio.string -> string
|
|
370
|
+
# -->
|
|
205
371
|
# Returns underlying String object, the subject of IO.
|
|
206
372
|
#
|
|
207
373
|
def string: () -> String
|
|
208
374
|
|
|
375
|
+
# <!--
|
|
376
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
377
|
+
# - strio.string = string -> string
|
|
378
|
+
# -->
|
|
209
379
|
# Changes underlying String object, the subject of IO.
|
|
210
380
|
#
|
|
211
381
|
def string=: (String str) -> String
|
|
212
382
|
|
|
383
|
+
# <!--
|
|
384
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
385
|
+
# - strio.length -> integer
|
|
386
|
+
# - strio.size -> integer
|
|
387
|
+
# -->
|
|
213
388
|
# Returns the size of the buffer string.
|
|
214
389
|
#
|
|
215
390
|
def size: () -> Integer
|
|
216
391
|
|
|
392
|
+
# <!--
|
|
393
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
394
|
+
# - strio.sync -> true
|
|
395
|
+
# -->
|
|
217
396
|
# Returns `true` always.
|
|
218
397
|
#
|
|
219
398
|
def sync: () -> bool
|
|
220
399
|
|
|
400
|
+
# <!--
|
|
401
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
402
|
+
# - sync=(p1)
|
|
403
|
+
# -->
|
|
221
404
|
# Returns the argument unchanged. Just for compatibility to IO.
|
|
222
405
|
#
|
|
223
406
|
def sync=: (boolish) -> bool
|
|
@@ -226,24 +409,43 @@ class StringIO
|
|
|
226
409
|
|
|
227
410
|
def syswrite: (String arg0) -> Integer
|
|
228
411
|
|
|
412
|
+
# <!--
|
|
413
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
414
|
+
# - strio.pos -> integer
|
|
415
|
+
# - strio.tell -> integer
|
|
416
|
+
# -->
|
|
229
417
|
# Returns the current offset (in bytes).
|
|
230
418
|
#
|
|
231
419
|
def tell: () -> Integer
|
|
232
420
|
|
|
421
|
+
# <!-- rdoc-file=ext/stringio/stringio.c -->
|
|
233
422
|
# Returns `false`. Just for compatibility to IO.
|
|
234
423
|
#
|
|
235
424
|
def tty?: () -> bool
|
|
236
425
|
|
|
426
|
+
# <!--
|
|
427
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
428
|
+
# - strio.ungetbyte(fixnum) -> nil
|
|
429
|
+
# -->
|
|
237
430
|
# See IO#ungetbyte
|
|
238
431
|
#
|
|
239
432
|
def ungetbyte: (String | Integer arg0) -> nil
|
|
240
433
|
|
|
434
|
+
# <!--
|
|
435
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
436
|
+
# - strio.ungetc(string) -> nil
|
|
437
|
+
# -->
|
|
241
438
|
# Pushes back one character (passed as a parameter) such that a subsequent
|
|
242
439
|
# buffered read will return it. There is no limitation for multiple pushbacks
|
|
243
440
|
# including pushing back behind the beginning of the buffer string.
|
|
244
441
|
#
|
|
245
442
|
def ungetc: (String arg0) -> nil
|
|
246
443
|
|
|
444
|
+
# <!--
|
|
445
|
+
# rdoc-file=ext/stringio/stringio.c
|
|
446
|
+
# - strio.write(string, ...) -> integer
|
|
447
|
+
# - strio.syswrite(string) -> integer
|
|
448
|
+
# -->
|
|
247
449
|
# Appends the given string to the underlying buffer string. The stream must be
|
|
248
450
|
# opened for writing. If the argument is not a string, it will be converted to
|
|
249
451
|
# a string using `to_s`. Returns the number of bytes written. See IO#write.
|
|
@@ -265,11 +467,13 @@ class StringIO
|
|
|
265
467
|
def codepoints: () { (Integer arg0) -> untyped } -> self
|
|
266
468
|
| () -> ::Enumerator[Integer, self]
|
|
267
469
|
|
|
470
|
+
# <!-- rdoc-file=ext/stringio/stringio.c -->
|
|
268
471
|
# See IO#each.
|
|
269
472
|
#
|
|
270
473
|
def each_line: (?String sep, ?Integer limit, ?chomp: boolish) { (String) -> untyped } -> self
|
|
271
474
|
| (?String sep, ?Integer limit, ?chomp: boolish) -> ::Enumerator[String, self]
|
|
272
475
|
|
|
476
|
+
# <!-- rdoc-file=ext/stringio/stringio.c -->
|
|
273
477
|
# Returns true if the stream is at the end of the data (underlying string). The
|
|
274
478
|
# stream must be opened for reading or an `IOError` will be raised.
|
|
275
479
|
#
|