rbs 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.gitignore +0 -1
- data/CHANGELOG.md +7 -2
- data/Gemfile +3 -0
- data/README.md +8 -2
- data/Steepfile +1 -0
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/docs/CONTRIBUTING.md +1 -0
- data/goodcheck.yml +22 -5
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/definition_builder.rb +4 -5
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3146 -0
- data/lib/rbs/parser.y +7 -2
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/type_check.rb +2 -2
- data/lib/rbs/type_name.rb +1 -1
- data/lib/rbs/variance_calculator.rb +1 -1
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -1
- data/sig/constant.rbs +2 -2
- data/sig/constant_table.rbs +10 -10
- data/sig/declarations.rbs +1 -1
- data/sig/definition.rbs +1 -1
- data/sig/namespace.rbs +3 -3
- data/sig/parser.rbs +25 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/writer.rbs +15 -15
- data/stdlib/benchmark/benchmark.rbs +2 -2
- data/stdlib/builtin/basic_object.rbs +54 -54
- data/stdlib/builtin/binding.rbs +42 -42
- data/stdlib/builtin/class.rbs +33 -33
- data/stdlib/builtin/complex.rbs +90 -90
- data/stdlib/builtin/encoding.rbs +33 -33
- data/stdlib/builtin/enumerable.rbs +32 -32
- data/stdlib/builtin/enumerator.rbs +35 -35
- data/stdlib/builtin/errors.rbs +1 -1
- data/stdlib/builtin/exception.rbs +50 -50
- data/stdlib/builtin/false_class.rbs +6 -6
- data/stdlib/builtin/fiber.rbs +14 -14
- data/stdlib/builtin/fiber_error.rbs +1 -1
- data/stdlib/builtin/float.rbs +161 -161
- data/stdlib/builtin/gc.rbs +1 -1
- data/stdlib/builtin/io.rbs +83 -83
- data/stdlib/builtin/kernel.rbs +69 -69
- data/stdlib/builtin/match_data.rbs +1 -1
- data/stdlib/builtin/method.rbs +19 -19
- data/stdlib/builtin/nil_class.rbs +20 -20
- data/stdlib/builtin/numeric.rbs +101 -101
- data/stdlib/builtin/object.rbs +172 -172
- data/stdlib/builtin/proc.rbs +91 -91
- data/stdlib/builtin/range.rbs +2 -4
- data/stdlib/builtin/rational.rbs +83 -83
- data/stdlib/builtin/signal.rbs +7 -7
- data/stdlib/builtin/string.rbs +4 -4
- data/stdlib/builtin/string_io.rbs +1 -1
- data/stdlib/builtin/thread.rbs +185 -185
- data/stdlib/builtin/thread_group.rbs +2 -2
- data/stdlib/builtin/true_class.rbs +9 -9
- data/stdlib/builtin/warning.rbs +1 -1
- data/stdlib/date/date.rbs +2 -2
- data/stdlib/find/find.rbs +10 -10
- data/stdlib/pathname/pathname.rbs +1 -1
- data/stdlib/tmpdir/tmpdir.rbs +12 -12
- metadata +3 -2
data/stdlib/builtin/gc.rbs
CHANGED
data/stdlib/builtin/io.rbs
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# output in Ruby. An I/O stream may be *duplexed* (that is,
|
3
3
|
# bidirectional), and so may use more than one native operating system
|
4
4
|
# stream.
|
5
|
-
#
|
5
|
+
#
|
6
6
|
# Many of the examples in this section use the
|
7
7
|
# [File](https://ruby-doc.org/core-2.6.3/File.html) class, the only
|
8
8
|
# standard subclass of [IO](IO). The two classes are
|
@@ -10,47 +10,47 @@
|
|
10
10
|
# [File](https://ruby-doc.org/core-2.6.3/File.html) class, the Socket
|
11
11
|
# library subclasses from [IO](IO) (such as TCPSocket
|
12
12
|
# or UDPSocket).
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# The
|
15
15
|
# [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
|
16
16
|
# method can create an [IO](IO) (or
|
17
17
|
# [File](https://ruby-doc.org/core-2.6.3/File.html) ) object for these
|
18
18
|
# types of arguments:
|
19
|
-
#
|
19
|
+
#
|
20
20
|
# - A plain string represents a filename suitable for the underlying
|
21
21
|
# operating system.
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# - A string starting with `"|"` indicates a subprocess. The remainder
|
24
24
|
# of the string following the `"|"` is invoked as a process with
|
25
25
|
# appropriate input/output channels connected to it.
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# - A string equal to `"|-"` will create another Ruby instance as a
|
28
28
|
# subprocess.
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# The [IO](IO) may be opened with different file modes
|
31
31
|
# (read-only, write-only) and encodings for proper conversion. See
|
32
32
|
# [::new](IO#method-c-new) for these options. See
|
33
33
|
# [Kernel\#open](https://ruby-doc.org/core-2.6.3/Kernel.html#method-i-open)
|
34
34
|
# for details of the various command formats described above.
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# [::popen](IO#method-c-popen), the Open3 library, or
|
37
37
|
# Process\#spawn may also be used to communicate with subprocesses through
|
38
38
|
# an [IO](IO).
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# Ruby will convert pathnames between different operating system
|
41
41
|
# conventions if possible. For instance, on a Windows system the filename
|
42
42
|
# `"/gumby/ruby/test.rb"` will be opened as `"\gumby\ruby\test.rb"` . When
|
43
43
|
# specifying a Windows-style filename in a Ruby string, remember to escape
|
44
44
|
# the backslashes:
|
45
|
-
#
|
45
|
+
#
|
46
46
|
# ```ruby
|
47
47
|
# "C:\\gumby\\ruby\\test.rb"
|
48
48
|
# ```
|
49
|
-
#
|
49
|
+
#
|
50
50
|
# Our examples here will use the Unix-style forward slashes;
|
51
51
|
# File::ALT\_SEPARATOR can be used to get the platform-specific separator
|
52
52
|
# character.
|
53
|
-
#
|
53
|
+
#
|
54
54
|
# The global constant [ARGF](https://ruby-doc.org/core-2.6.3/ARGF.html)
|
55
55
|
# (also accessible as `$<` ) provides an IO-like stream which allows
|
56
56
|
# access to all files mentioned on the command line (or STDIN if no files
|
@@ -59,44 +59,44 @@
|
|
59
59
|
# and its alias
|
60
60
|
# [ARGF\#filename](https://ruby-doc.org/core-2.6.3/ARGF.html#method-i-filename)
|
61
61
|
# are provided to access the name of the file currently being read.
|
62
|
-
#
|
63
|
-
#
|
62
|
+
#
|
63
|
+
#
|
64
64
|
# The io/console extension provides methods for interacting with the
|
65
65
|
# console. The console can be accessed from IO.console or the standard
|
66
66
|
# input/output/error [IO](IO) objects.
|
67
|
-
#
|
67
|
+
#
|
68
68
|
# Requiring io/console adds the following methods:
|
69
|
-
#
|
69
|
+
#
|
70
70
|
# - IO::console
|
71
|
-
#
|
71
|
+
#
|
72
72
|
# - IO\#raw
|
73
|
-
#
|
73
|
+
#
|
74
74
|
# - IO\#raw\!
|
75
|
-
#
|
75
|
+
#
|
76
76
|
# - IO\#cooked
|
77
|
-
#
|
77
|
+
#
|
78
78
|
# - IO\#cooked\!
|
79
|
-
#
|
79
|
+
#
|
80
80
|
# - IO\#getch
|
81
|
-
#
|
81
|
+
#
|
82
82
|
# - IO\#echo=
|
83
|
-
#
|
83
|
+
#
|
84
84
|
# - IO\#echo?
|
85
|
-
#
|
85
|
+
#
|
86
86
|
# - IO\#noecho
|
87
|
-
#
|
87
|
+
#
|
88
88
|
# - IO\#winsize
|
89
|
-
#
|
89
|
+
#
|
90
90
|
# - IO\#winsize=
|
91
|
-
#
|
91
|
+
#
|
92
92
|
# - IO\#iflush
|
93
|
-
#
|
93
|
+
#
|
94
94
|
# - IO\#ioflush
|
95
|
-
#
|
95
|
+
#
|
96
96
|
# - IO\#oflush
|
97
|
-
#
|
97
|
+
#
|
98
98
|
# Example:
|
99
|
-
#
|
99
|
+
#
|
100
100
|
# ```ruby
|
101
101
|
# require 'io/console'
|
102
102
|
# rows, columns = $stdout.winsize
|
@@ -119,11 +119,11 @@ class IO < Object
|
|
119
119
|
|
120
120
|
# Puts *ios* into binary mode. Once a stream is in binary mode, it cannot
|
121
121
|
# be reset to nonbinary mode.
|
122
|
-
#
|
122
|
+
#
|
123
123
|
# - newline conversion disabled
|
124
|
-
#
|
124
|
+
#
|
125
125
|
# - encoding conversion disabled
|
126
|
-
#
|
126
|
+
#
|
127
127
|
# - content is treated as ASCII-8BIT
|
128
128
|
def binmode: () -> self
|
129
129
|
|
@@ -134,9 +134,9 @@ class IO < Object
|
|
134
134
|
# stream is unavailable for any further data operations; an `IOError` is
|
135
135
|
# raised if such an attempt is made. I/O streams are automatically closed
|
136
136
|
# when they are claimed by the garbage collector.
|
137
|
-
#
|
137
|
+
#
|
138
138
|
# If *ios* is opened by `IO.popen`, `close` sets `$?` .
|
139
|
-
#
|
139
|
+
#
|
140
140
|
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
141
141
|
# just ignored since Ruby 2.3.
|
142
142
|
def close: () -> NilClass
|
@@ -144,7 +144,7 @@ class IO < Object
|
|
144
144
|
def close_on_exec=: (bool arg0) -> bool
|
145
145
|
|
146
146
|
# Returns `true` if *ios* will be closed on exec.
|
147
|
-
#
|
147
|
+
#
|
148
148
|
# ```ruby
|
149
149
|
# f = open("/dev/null")
|
150
150
|
# f.close_on_exec? #=> false
|
@@ -158,18 +158,18 @@ class IO < Object
|
|
158
158
|
# Closes the read end of a duplex I/O stream (i.e., one that contains both
|
159
159
|
# a read and a write stream, such as a pipe). Will raise an `IOError` if
|
160
160
|
# the stream is not duplexed.
|
161
|
-
#
|
161
|
+
#
|
162
162
|
# ```ruby
|
163
163
|
# f = IO.popen("/bin/sh","r+")
|
164
164
|
# f.close_read
|
165
165
|
# f.readlines
|
166
166
|
# ```
|
167
|
-
#
|
167
|
+
#
|
168
168
|
# *produces:*
|
169
|
-
#
|
169
|
+
#
|
170
170
|
# prog.rb:3:in `readlines': not opened for reading (IOError)
|
171
171
|
# from prog.rb:3
|
172
|
-
#
|
172
|
+
#
|
173
173
|
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
174
174
|
# just ignored since Ruby 2.3.
|
175
175
|
def close_read: () -> NilClass
|
@@ -177,26 +177,26 @@ class IO < Object
|
|
177
177
|
# Closes the write end of a duplex I/O stream (i.e., one that contains
|
178
178
|
# both a read and a write stream, such as a pipe). Will raise an `IOError`
|
179
179
|
# if the stream is not duplexed.
|
180
|
-
#
|
180
|
+
#
|
181
181
|
# ```ruby
|
182
182
|
# f = IO.popen("/bin/sh","r+")
|
183
183
|
# f.close_write
|
184
184
|
# f.print "nowhere"
|
185
185
|
# ```
|
186
|
-
#
|
186
|
+
#
|
187
187
|
# *produces:*
|
188
|
-
#
|
188
|
+
#
|
189
189
|
# prog.rb:3:in `write': not opened for writing (IOError)
|
190
190
|
# from prog.rb:3:in `print'
|
191
191
|
# from prog.rb:3
|
192
|
-
#
|
192
|
+
#
|
193
193
|
# Calling this method on closed [IO](IO.downloaded.ruby_doc) object is
|
194
194
|
# just ignored since Ruby 2.3.
|
195
195
|
def close_write: () -> NilClass
|
196
196
|
|
197
197
|
# Returns `true` if *ios* is completely closed (for duplex streams, both
|
198
198
|
# reader and writer), `false` otherwise.
|
199
|
-
#
|
199
|
+
#
|
200
200
|
# ```ruby
|
201
201
|
# f = File.new("testfile")
|
202
202
|
# f.close #=> nil
|
@@ -224,29 +224,29 @@ class IO < Object
|
|
224
224
|
# Returns true if *ios* is at end of file that means there are no more
|
225
225
|
# data to read. The stream must be opened for reading or an `IOError` will
|
226
226
|
# be raised.
|
227
|
-
#
|
227
|
+
#
|
228
228
|
# ```ruby
|
229
229
|
# f = File.new("testfile")
|
230
230
|
# dummy = f.readlines
|
231
231
|
# f.eof #=> true
|
232
232
|
# ```
|
233
|
-
#
|
233
|
+
#
|
234
234
|
# If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
|
235
235
|
# other end sends some data or closes it.
|
236
|
-
#
|
236
|
+
#
|
237
237
|
# ```ruby
|
238
238
|
# r, w = IO.pipe
|
239
239
|
# Thread.new { sleep 1; w.close }
|
240
240
|
# r.eof? #=> true after 1 second blocking
|
241
|
-
#
|
241
|
+
#
|
242
242
|
# r, w = IO.pipe
|
243
243
|
# Thread.new { sleep 1; w.puts "a" }
|
244
244
|
# r.eof? #=> false after 1 second blocking
|
245
|
-
#
|
245
|
+
#
|
246
246
|
# r, w = IO.pipe
|
247
247
|
# r.eof? # blocks forever
|
248
248
|
# ```
|
249
|
-
#
|
249
|
+
#
|
250
250
|
# Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
|
251
251
|
# may not behave as you intend with `IO#eof?`, unless you call
|
252
252
|
# `IO#rewind` first (which is not available for some streams).
|
@@ -255,35 +255,35 @@ class IO < Object
|
|
255
255
|
def fcntl: (Integer integer_cmd, String | Integer arg) -> Integer
|
256
256
|
|
257
257
|
# Immediately writes all buffered data in *ios* to disk.
|
258
|
-
#
|
258
|
+
#
|
259
259
|
# If the underlying operating system does not support *fdatasync(2)* ,
|
260
260
|
# `IO#fsync` is called instead (which might raise a `NotImplementedError`
|
261
261
|
# ).
|
262
262
|
def fdatasync: () -> Integer?
|
263
263
|
|
264
264
|
# Returns an integer representing the numeric file descriptor for *ios* .
|
265
|
-
#
|
265
|
+
#
|
266
266
|
# ```ruby
|
267
267
|
# $stdin.fileno #=> 0
|
268
268
|
# $stdout.fileno #=> 1
|
269
269
|
# ```
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
270
|
+
#
|
271
|
+
#
|
272
|
+
#
|
273
273
|
# Also aliased as: [to\_i](IO.downloaded.ruby_doc#method-i-to_i)
|
274
274
|
def fileno: () -> Integer
|
275
275
|
|
276
276
|
# Flushes any buffered data within *ios* to the underlying operating
|
277
277
|
# system (note that this is Ruby internal buffering only; the OS may
|
278
278
|
# buffer the data as well).
|
279
|
-
#
|
279
|
+
#
|
280
280
|
# ```ruby
|
281
281
|
# $stdout.print "no newline"
|
282
282
|
# $stdout.flush
|
283
283
|
# ```
|
284
|
-
#
|
284
|
+
#
|
285
285
|
# *produces:*
|
286
|
-
#
|
286
|
+
#
|
287
287
|
# ```ruby
|
288
288
|
# no newline
|
289
289
|
# ```
|
@@ -293,14 +293,14 @@ class IO < Object
|
|
293
293
|
# differs from using `IO#sync=` . The latter ensures that data is flushed
|
294
294
|
# from Ruby’s buffers, but does not guarantee that the underlying
|
295
295
|
# operating system actually writes it to disk.
|
296
|
-
#
|
296
|
+
#
|
297
297
|
# `NotImplementedError` is raised if the underlying operating system does
|
298
298
|
# not support *fsync(2)* .
|
299
299
|
def fsync: () -> Integer?
|
300
300
|
|
301
301
|
# Gets the next 8-bit byte (0..255) from *ios* . Returns `nil` if called
|
302
302
|
# at end of file.
|
303
|
-
#
|
303
|
+
#
|
304
304
|
# ```ruby
|
305
305
|
# f = File.new("testfile")
|
306
306
|
# f.getbyte #=> 84
|
@@ -310,7 +310,7 @@ class IO < Object
|
|
310
310
|
|
311
311
|
# Reads a one-character string from *ios* . Returns `nil` if called at end
|
312
312
|
# of file.
|
313
|
-
#
|
313
|
+
#
|
314
314
|
# ```ruby
|
315
315
|
# f = File.new("testfile")
|
316
316
|
# f.getc #=> "h"
|
@@ -334,7 +334,7 @@ class IO < Object
|
|
334
334
|
|
335
335
|
# Returns `true` if *ios* is associated with a terminal device (tty),
|
336
336
|
# `false` otherwise.
|
337
|
-
#
|
337
|
+
#
|
338
338
|
# ```ruby
|
339
339
|
# File.new("testfile").isatty #=> false
|
340
340
|
# File.new("/dev/tty").isatty #=> true
|
@@ -347,14 +347,14 @@ class IO < Object
|
|
347
347
|
# number of newlines encountered. The two values will differ if
|
348
348
|
# [gets](IO.downloaded.ruby_doc#method-i-gets) is called with a separator
|
349
349
|
# other than newline.
|
350
|
-
#
|
350
|
+
#
|
351
351
|
# Methods that use `$/` like [each](IO.downloaded.ruby_doc#method-i-each)
|
352
352
|
# , [lines](IO.downloaded.ruby_doc#method-i-lines) and
|
353
353
|
# [readline](IO.downloaded.ruby_doc#method-i-readline) will also increment
|
354
354
|
# `lineno` .
|
355
|
-
#
|
355
|
+
#
|
356
356
|
# See also the `$.` variable.
|
357
|
-
#
|
357
|
+
#
|
358
358
|
# ```ruby
|
359
359
|
# f = File.new("testfile")
|
360
360
|
# f.lineno #=> 0
|
@@ -369,7 +369,7 @@ class IO < Object
|
|
369
369
|
|
370
370
|
# Returns the process ID of a child process associated with *ios* . This
|
371
371
|
# will be set by `IO.popen` .
|
372
|
-
#
|
372
|
+
#
|
373
373
|
# ```ruby
|
374
374
|
# pipe = IO.popen("-")
|
375
375
|
# if pipe
|
@@ -378,15 +378,15 @@ class IO < Object
|
|
378
378
|
# $stderr.puts "In child, pid is #{$$}"
|
379
379
|
# end
|
380
380
|
# ```
|
381
|
-
#
|
381
|
+
#
|
382
382
|
# *produces:*
|
383
|
-
#
|
383
|
+
#
|
384
384
|
# In child, pid is 26209
|
385
385
|
# In parent, child pid is 26209
|
386
386
|
def pid: () -> Integer
|
387
387
|
|
388
388
|
# Returns the current offset (in bytes) of *ios* .
|
389
|
-
#
|
389
|
+
#
|
390
390
|
# ```ruby
|
391
391
|
# f = File.new("testfile")
|
392
392
|
# f.pos #=> 0
|
@@ -416,7 +416,7 @@ class IO < Object
|
|
416
416
|
|
417
417
|
# Reads a one-character string from *ios* . Raises an `EOFError` on end of
|
418
418
|
# file.
|
419
|
-
#
|
419
|
+
#
|
420
420
|
# ```ruby
|
421
421
|
# f = File.new("testfile")
|
422
422
|
# f.readchar #=> "h"
|
@@ -435,7 +435,7 @@ class IO < Object
|
|
435
435
|
| (String other_IO_or_path, ?String mode_str) -> IO
|
436
436
|
|
437
437
|
# Positions *ios* to the beginning of input, resetting `lineno` to zero.
|
438
|
-
#
|
438
|
+
#
|
439
439
|
# ```ruby
|
440
440
|
# f = File.new("testfile")
|
441
441
|
# f.readline #=> "This is line one\n"
|
@@ -443,7 +443,7 @@ class IO < Object
|
|
443
443
|
# f.lineno #=> 0
|
444
444
|
# f.readline #=> "This is line one\n"
|
445
445
|
# ```
|
446
|
-
#
|
446
|
+
#
|
447
447
|
# Note that it cannot be used with streams such as pipes, ttys, and
|
448
448
|
# sockets.
|
449
449
|
def rewind: () -> Integer
|
@@ -454,7 +454,7 @@ class IO < Object
|
|
454
454
|
| (?String | Encoding ext_or_ext_int_enc, ?String | Encoding int_enc) -> self
|
455
455
|
|
456
456
|
# Returns status information for *ios* as an object of type `File::Stat` .
|
457
|
-
#
|
457
|
+
#
|
458
458
|
# ```ruby
|
459
459
|
# f = File.new("testfile")
|
460
460
|
# s = f.stat
|
@@ -467,7 +467,7 @@ class IO < Object
|
|
467
467
|
# Returns the current “sync mode” of *ios* . When sync mode is true, all
|
468
468
|
# output is immediately flushed to the underlying operating system and is
|
469
469
|
# not buffered by Ruby internally. See also `IO#fsync` .
|
470
|
-
#
|
470
|
+
#
|
471
471
|
# ```ruby
|
472
472
|
# f = File.new("testfile")
|
473
473
|
# f.sync #=> false
|
@@ -483,7 +483,7 @@ class IO < Object
|
|
483
483
|
def syswrite: (_ToS arg0) -> Integer
|
484
484
|
|
485
485
|
# Returns the current offset (in bytes) of *ios* .
|
486
|
-
#
|
486
|
+
#
|
487
487
|
# ```ruby
|
488
488
|
# f = File.new("testfile")
|
489
489
|
# f.pos #=> 0
|
@@ -497,7 +497,7 @@ class IO < Object
|
|
497
497
|
|
498
498
|
# Returns `true` if *ios* is associated with a terminal device (tty),
|
499
499
|
# `false` otherwise.
|
500
|
-
#
|
500
|
+
#
|
501
501
|
# ```ruby
|
502
502
|
# File.new("testfile").isatty #=> false
|
503
503
|
# File.new("/dev/tty").isatty #=> true
|
@@ -547,29 +547,29 @@ class IO < Object
|
|
547
547
|
# Returns true if *ios* is at end of file that means there are no more
|
548
548
|
# data to read. The stream must be opened for reading or an `IOError` will
|
549
549
|
# be raised.
|
550
|
-
#
|
550
|
+
#
|
551
551
|
# ```ruby
|
552
552
|
# f = File.new("testfile")
|
553
553
|
# dummy = f.readlines
|
554
554
|
# f.eof #=> true
|
555
555
|
# ```
|
556
|
-
#
|
556
|
+
#
|
557
557
|
# If *ios* is a stream such as pipe or socket, `IO#eof?` blocks until the
|
558
558
|
# other end sends some data or closes it.
|
559
|
-
#
|
559
|
+
#
|
560
560
|
# ```ruby
|
561
561
|
# r, w = IO.pipe
|
562
562
|
# Thread.new { sleep 1; w.close }
|
563
563
|
# r.eof? #=> true after 1 second blocking
|
564
|
-
#
|
564
|
+
#
|
565
565
|
# r, w = IO.pipe
|
566
566
|
# Thread.new { sleep 1; w.puts "a" }
|
567
567
|
# r.eof? #=> false after 1 second blocking
|
568
|
-
#
|
568
|
+
#
|
569
569
|
# r, w = IO.pipe
|
570
570
|
# r.eof? # blocks forever
|
571
571
|
# ```
|
572
|
-
#
|
572
|
+
#
|
573
573
|
# Note that `IO#eof?` reads data to the input byte buffer. So `IO#sysread`
|
574
574
|
# may not behave as you intend with `IO#eof?`, unless you call
|
575
575
|
# `IO#rewind` first (which is not available for some streams).
|