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/stdlib/pstore/0/pstore.rbs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# <!-- rdoc-file=lib/pstore.rb -->
|
|
1
2
|
# PStore implements a file based persistence mechanism based on a Hash. User
|
|
2
3
|
# code can store hierarchies of Ruby objects (values) into the data store file
|
|
3
4
|
# by name (keys). An object hierarchy may be just a single object. User code
|
|
@@ -82,6 +83,10 @@
|
|
|
82
83
|
class PStore
|
|
83
84
|
public
|
|
84
85
|
|
|
86
|
+
# <!--
|
|
87
|
+
# rdoc-file=lib/pstore.rb
|
|
88
|
+
# - [](name)
|
|
89
|
+
# -->
|
|
85
90
|
# Retrieves a value from the PStore file data, by *name*. The hierarchy of Ruby
|
|
86
91
|
# objects stored under that root *name* will be returned.
|
|
87
92
|
#
|
|
@@ -90,6 +95,10 @@ class PStore
|
|
|
90
95
|
#
|
|
91
96
|
def []: (untyped name) -> untyped
|
|
92
97
|
|
|
98
|
+
# <!--
|
|
99
|
+
# rdoc-file=lib/pstore.rb
|
|
100
|
+
# - []=(name, value)
|
|
101
|
+
# -->
|
|
93
102
|
# Stores an individual Ruby object or a hierarchy of Ruby objects in the data
|
|
94
103
|
# store file under the root *name*. Assigning to a *name* already in the data
|
|
95
104
|
# store clobbers the old data.
|
|
@@ -111,6 +120,10 @@ class PStore
|
|
|
111
120
|
#
|
|
112
121
|
def []=: (untyped name, untyped value) -> untyped
|
|
113
122
|
|
|
123
|
+
# <!--
|
|
124
|
+
# rdoc-file=lib/pstore.rb
|
|
125
|
+
# - abort()
|
|
126
|
+
# -->
|
|
114
127
|
# Ends the current PStore#transaction, discarding any changes to the data store.
|
|
115
128
|
#
|
|
116
129
|
# ## Example:
|
|
@@ -132,6 +145,10 @@ class PStore
|
|
|
132
145
|
#
|
|
133
146
|
def abort: () -> untyped
|
|
134
147
|
|
|
148
|
+
# <!--
|
|
149
|
+
# rdoc-file=lib/pstore.rb
|
|
150
|
+
# - commit()
|
|
151
|
+
# -->
|
|
135
152
|
# Ends the current PStore#transaction, committing any changes to the data store
|
|
136
153
|
# immediately.
|
|
137
154
|
#
|
|
@@ -155,6 +172,10 @@ class PStore
|
|
|
155
172
|
#
|
|
156
173
|
def commit: () -> nil
|
|
157
174
|
|
|
175
|
+
# <!--
|
|
176
|
+
# rdoc-file=lib/pstore.rb
|
|
177
|
+
# - delete(name)
|
|
178
|
+
# -->
|
|
158
179
|
# Removes an object hierarchy from the data store, by *name*.
|
|
159
180
|
#
|
|
160
181
|
# **WARNING**: This method is only valid in a PStore#transaction and it cannot
|
|
@@ -162,6 +183,10 @@ class PStore
|
|
|
162
183
|
#
|
|
163
184
|
def delete: (untyped name) -> untyped
|
|
164
185
|
|
|
186
|
+
# <!--
|
|
187
|
+
# rdoc-file=lib/pstore.rb
|
|
188
|
+
# - fetch(name, default=PStore::Error)
|
|
189
|
+
# -->
|
|
165
190
|
# This method is just like PStore#[], save that you may also provide a *default*
|
|
166
191
|
# value for the object. In the event the specified *name* is not found in the
|
|
167
192
|
# data store, your *default* will be returned instead. If you do not specify a
|
|
@@ -172,10 +197,18 @@ class PStore
|
|
|
172
197
|
#
|
|
173
198
|
def fetch: (untyped name, ?untyped default) -> untyped
|
|
174
199
|
|
|
200
|
+
# <!--
|
|
201
|
+
# rdoc-file=lib/pstore.rb
|
|
202
|
+
# - path()
|
|
203
|
+
# -->
|
|
175
204
|
# Returns the path to the data store file.
|
|
176
205
|
#
|
|
177
206
|
def path: () -> untyped
|
|
178
207
|
|
|
208
|
+
# <!--
|
|
209
|
+
# rdoc-file=lib/pstore.rb
|
|
210
|
+
# - root?(name)
|
|
211
|
+
# -->
|
|
179
212
|
# Returns true if the supplied *name* is currently in the data store.
|
|
180
213
|
#
|
|
181
214
|
# **WARNING**: This method is only valid in a PStore#transaction. It will
|
|
@@ -183,6 +216,10 @@ class PStore
|
|
|
183
216
|
#
|
|
184
217
|
def root?: (untyped name) -> bool
|
|
185
218
|
|
|
219
|
+
# <!--
|
|
220
|
+
# rdoc-file=lib/pstore.rb
|
|
221
|
+
# - roots()
|
|
222
|
+
# -->
|
|
186
223
|
# Returns the names of all object hierarchies currently in the store.
|
|
187
224
|
#
|
|
188
225
|
# **WARNING**: This method is only valid in a PStore#transaction. It will
|
|
@@ -190,6 +227,10 @@ class PStore
|
|
|
190
227
|
#
|
|
191
228
|
def roots: () -> Array[untyped]
|
|
192
229
|
|
|
230
|
+
# <!--
|
|
231
|
+
# rdoc-file=lib/pstore.rb
|
|
232
|
+
# - transaction(read_only = false) { |pstore| ... }
|
|
233
|
+
# -->
|
|
193
234
|
# Opens a new transaction for the data store. Code executed inside a block
|
|
194
235
|
# passed to this method may read and write data to and from the data store file.
|
|
195
236
|
#
|
|
@@ -207,6 +248,7 @@ class PStore
|
|
|
207
248
|
#
|
|
208
249
|
def transaction: (?untyped read_only) -> untyped
|
|
209
250
|
|
|
251
|
+
# <!-- rdoc-file=lib/pstore.rb -->
|
|
210
252
|
# Whether PStore should do its best to prevent file corruptions, even when under
|
|
211
253
|
# unlikely-to-occur error conditions such as out-of-space conditions and other
|
|
212
254
|
# unusual OS filesystem errors. Setting this flag comes at the price in the form
|
|
@@ -218,25 +260,57 @@ class PStore
|
|
|
218
260
|
#
|
|
219
261
|
def ultra_safe: () -> untyped
|
|
220
262
|
|
|
263
|
+
# <!-- rdoc-file=lib/pstore.rb -->
|
|
264
|
+
# Whether PStore should do its best to prevent file corruptions, even when under
|
|
265
|
+
# unlikely-to-occur error conditions such as out-of-space conditions and other
|
|
266
|
+
# unusual OS filesystem errors. Setting this flag comes at the price in the form
|
|
267
|
+
# of a performance loss.
|
|
268
|
+
#
|
|
269
|
+
# This flag only has effect on platforms on which file renames are atomic (e.g.
|
|
270
|
+
# all POSIX platforms: Linux, MacOS X, FreeBSD, etc). The default value is
|
|
271
|
+
# false.
|
|
272
|
+
#
|
|
221
273
|
def ultra_safe=: (untyped) -> untyped
|
|
222
274
|
|
|
223
275
|
private
|
|
224
276
|
|
|
225
277
|
def dump: (untyped table) -> untyped
|
|
226
278
|
|
|
279
|
+
# <!--
|
|
280
|
+
# rdoc-file=lib/pstore.rb
|
|
281
|
+
# - empty_marshal_checksum()
|
|
282
|
+
# -->
|
|
283
|
+
#
|
|
227
284
|
def empty_marshal_checksum: () -> untyped
|
|
228
285
|
|
|
286
|
+
# <!--
|
|
287
|
+
# rdoc-file=lib/pstore.rb
|
|
288
|
+
# - empty_marshal_data()
|
|
289
|
+
# -->
|
|
290
|
+
#
|
|
229
291
|
def empty_marshal_data: () -> untyped
|
|
230
292
|
|
|
293
|
+
# <!--
|
|
294
|
+
# rdoc-file=lib/pstore.rb
|
|
295
|
+
# - in_transaction()
|
|
296
|
+
# -->
|
|
231
297
|
# Raises PStore::Error if the calling code is not in a PStore#transaction.
|
|
232
298
|
#
|
|
233
299
|
def in_transaction: () -> untyped
|
|
234
300
|
|
|
301
|
+
# <!--
|
|
302
|
+
# rdoc-file=lib/pstore.rb
|
|
303
|
+
# - in_transaction_wr()
|
|
304
|
+
# -->
|
|
235
305
|
# Raises PStore::Error if the calling code is not in a PStore#transaction or if
|
|
236
306
|
# the code is in a read-only PStore#transaction.
|
|
237
307
|
#
|
|
238
308
|
def in_transaction_wr: () -> untyped
|
|
239
309
|
|
|
310
|
+
# <!--
|
|
311
|
+
# rdoc-file=lib/pstore.rb
|
|
312
|
+
# - new(file, thread_safe = false)
|
|
313
|
+
# -->
|
|
240
314
|
# To construct a PStore object, pass in the *file* path where you would like the
|
|
241
315
|
# data to be stored.
|
|
242
316
|
#
|
|
@@ -247,14 +321,27 @@ class PStore
|
|
|
247
321
|
|
|
248
322
|
def load: (untyped content) -> untyped
|
|
249
323
|
|
|
324
|
+
# <!--
|
|
325
|
+
# rdoc-file=lib/pstore.rb
|
|
326
|
+
# - load_data(file, read_only)
|
|
327
|
+
# -->
|
|
250
328
|
# Load the given PStore file. If `read_only` is true, the unmarshalled Hash will
|
|
251
329
|
# be returned. If `read_only` is false, a 3-tuple will be returned: the
|
|
252
330
|
# unmarshalled Hash, a checksum of the data, and the size of the data.
|
|
253
331
|
#
|
|
254
332
|
def load_data: (untyped file, untyped read_only) -> untyped
|
|
255
333
|
|
|
334
|
+
# <!--
|
|
335
|
+
# rdoc-file=lib/pstore.rb
|
|
336
|
+
# - on_windows?()
|
|
337
|
+
# -->
|
|
338
|
+
#
|
|
256
339
|
def on_windows?: () -> bool
|
|
257
340
|
|
|
341
|
+
# <!--
|
|
342
|
+
# rdoc-file=lib/pstore.rb
|
|
343
|
+
# - open_and_lock_file(filename, read_only)
|
|
344
|
+
# -->
|
|
258
345
|
# Open the specified filename (either in read-only mode or in read-write mode)
|
|
259
346
|
# and lock it for reading or writing.
|
|
260
347
|
#
|
|
@@ -265,10 +352,25 @@ class PStore
|
|
|
265
352
|
#
|
|
266
353
|
def open_and_lock_file: (untyped filename, untyped read_only) -> untyped
|
|
267
354
|
|
|
355
|
+
# <!--
|
|
356
|
+
# rdoc-file=lib/pstore.rb
|
|
357
|
+
# - save_data(original_checksum, original_file_size, file)
|
|
358
|
+
# -->
|
|
359
|
+
#
|
|
268
360
|
def save_data: (untyped original_checksum, untyped original_file_size, untyped file) -> untyped
|
|
269
361
|
|
|
362
|
+
# <!--
|
|
363
|
+
# rdoc-file=lib/pstore.rb
|
|
364
|
+
# - save_data_with_atomic_file_rename_strategy(data, file)
|
|
365
|
+
# -->
|
|
366
|
+
#
|
|
270
367
|
def save_data_with_atomic_file_rename_strategy: (untyped data, untyped file) -> untyped
|
|
271
368
|
|
|
369
|
+
# <!--
|
|
370
|
+
# rdoc-file=lib/pstore.rb
|
|
371
|
+
# - save_data_with_fast_strategy(data, file)
|
|
372
|
+
# -->
|
|
373
|
+
#
|
|
272
374
|
def save_data_with_fast_strategy: (untyped data, untyped file) -> untyped
|
|
273
375
|
end
|
|
274
376
|
|
data/stdlib/pty/0/pty.rbs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
# <!-- rdoc-file=ext/pty/pty.c -->
|
|
1
2
|
# Creates and manages pseudo terminals (PTYs). See also
|
|
2
|
-
#
|
|
3
|
+
# https://en.wikipedia.org/wiki/Pseudo_terminal
|
|
3
4
|
#
|
|
4
5
|
# PTY allows you to allocate new terminals using ::open or ::spawn a new
|
|
5
6
|
# terminal with a specific command.
|
|
@@ -42,18 +43,23 @@
|
|
|
42
43
|
#
|
|
43
44
|
# ## License
|
|
44
45
|
#
|
|
45
|
-
#
|
|
46
|
+
# (c) Copyright 1998 by Akinori Ito.
|
|
46
47
|
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
48
|
+
# This software may be redistributed freely for this purpose, in full or in
|
|
49
|
+
# part, provided that this entire copyright notice is included on any copies of
|
|
50
|
+
# this software and applications and derivations thereof.
|
|
50
51
|
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
52
|
+
# This software is provided on an "as is" basis, without warranty of any kind,
|
|
53
|
+
# either expressed or implied, as to any matter including, but not limited to
|
|
54
|
+
# warranty of fitness of purpose, or merchantability, or results obtained from
|
|
55
|
+
# use of this software.
|
|
55
56
|
#
|
|
56
57
|
module PTY
|
|
58
|
+
# <!--
|
|
59
|
+
# rdoc-file=ext/pty/pty.c
|
|
60
|
+
# - PTY.check(pid, raise = false) => Process::Status or nil
|
|
61
|
+
# - PTY.check(pid, true) => nil or raises PTY::ChildExited
|
|
62
|
+
# -->
|
|
57
63
|
# Checks the status of the child process specified by `pid`. Returns `nil` if
|
|
58
64
|
# the process is still alive.
|
|
59
65
|
#
|
|
@@ -68,12 +74,47 @@ module PTY
|
|
|
68
74
|
#
|
|
69
75
|
def self.check: (Integer pid, ?boolish raise) -> Process::Status?
|
|
70
76
|
|
|
77
|
+
# <!--
|
|
78
|
+
# rdoc-file=ext/pty/pty.c
|
|
79
|
+
# - PTY.spawn(command_line) { |r, w, pid| ... }
|
|
80
|
+
# - PTY.spawn(command_line) => [r, w, pid]
|
|
81
|
+
# - PTY.spawn(command, arguments, ...) { |r, w, pid| ... }
|
|
82
|
+
# - PTY.spawn(command, arguments, ...) => [r, w, pid]
|
|
83
|
+
# -->
|
|
84
|
+
# Spawns the specified command on a newly allocated pty. You can also use the
|
|
85
|
+
# alias ::getpty.
|
|
86
|
+
#
|
|
87
|
+
# The command's controlling tty is set to the slave device of the pty and its
|
|
88
|
+
# standard input/output/error is redirected to the slave device.
|
|
89
|
+
#
|
|
90
|
+
# `command` and `command_line` are the full commands to run, given a String. Any
|
|
91
|
+
# additional `arguments` will be passed to the command.
|
|
92
|
+
#
|
|
93
|
+
# ### Return values
|
|
94
|
+
#
|
|
95
|
+
# In the non-block form this returns an array of size three, `[r, w, pid]`.
|
|
96
|
+
#
|
|
97
|
+
# In the block form these same values will be yielded to the block:
|
|
98
|
+
#
|
|
99
|
+
# `r`
|
|
100
|
+
# : A readable IO that contains the command's standard output and standard
|
|
101
|
+
# error
|
|
102
|
+
# `w`
|
|
103
|
+
# : A writable IO that is the command's standard input
|
|
104
|
+
# `pid`
|
|
105
|
+
# : The process identifier for the command.
|
|
106
|
+
#
|
|
71
107
|
alias self.getpty self.spawn
|
|
72
108
|
|
|
109
|
+
# <!--
|
|
110
|
+
# rdoc-file=ext/pty/pty.c
|
|
111
|
+
# - PTY.open => [master_io, slave_file]
|
|
112
|
+
# - PTY.open {|(master_io, slave_file)| ... } => block value
|
|
113
|
+
# -->
|
|
73
114
|
# Allocates a pty (pseudo-terminal).
|
|
74
115
|
#
|
|
75
|
-
# In the block form, yields two
|
|
76
|
-
# of the block is returned from `open`.
|
|
116
|
+
# In the block form, yields an array of two elements (`master_io, slave_file`)
|
|
117
|
+
# and the value of the block is returned from `open`.
|
|
77
118
|
#
|
|
78
119
|
# The IO and File are both closed after the block completes if they haven't been
|
|
79
120
|
# already closed.
|
|
@@ -103,11 +144,19 @@ module PTY
|
|
|
103
144
|
# require 'io/console'
|
|
104
145
|
# PTY.open {|m, s|
|
|
105
146
|
# s.raw!
|
|
106
|
-
# ...
|
|
147
|
+
# # ...
|
|
107
148
|
# }
|
|
149
|
+
#
|
|
108
150
|
def self.open: () -> [ IO, File ]
|
|
109
|
-
| [A] () { ([ IO
|
|
151
|
+
| [A] () { ([ IO, File ]) -> A } -> A
|
|
110
152
|
|
|
153
|
+
# <!--
|
|
154
|
+
# rdoc-file=ext/pty/pty.c
|
|
155
|
+
# - PTY.spawn(command_line) { |r, w, pid| ... }
|
|
156
|
+
# - PTY.spawn(command_line) => [r, w, pid]
|
|
157
|
+
# - PTY.spawn(command, arguments, ...) { |r, w, pid| ... }
|
|
158
|
+
# - PTY.spawn(command, arguments, ...) => [r, w, pid]
|
|
159
|
+
# -->
|
|
111
160
|
# Spawns the specified command on a newly allocated pty. You can also use the
|
|
112
161
|
# alias ::getpty.
|
|
113
162
|
#
|
|
@@ -130,6 +179,7 @@ module PTY
|
|
|
130
179
|
# : A writable IO that is the command's standard input
|
|
131
180
|
# `pid`
|
|
132
181
|
# : The process identifier for the command.
|
|
182
|
+
#
|
|
133
183
|
def self.spawn: (*String command) -> [ IO, IO, Integer ]
|
|
134
|
-
| (*String command) {([ IO
|
|
184
|
+
| (*String command) { ([ IO, IO, Integer ]) -> void } -> void
|
|
135
185
|
end
|