Skip to content

Commit 9e7a985

Browse files
committed
[Bug #21509] [DOC] Correct IO#wait description
1 parent dbf7a0c commit 9e7a985

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

io.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9929,18 +9929,22 @@ io_event_from_value(VALUE value)
99299929
/*
99309930
* call-seq:
99319931
* io.wait(events, timeout) -> event mask, false or nil
9932-
* io.wait(timeout = nil, mode = :read) -> self, true, or false
9932+
* io.wait(*event_symbols[, timeout]) -> self, true, or false
99339933
*
99349934
* Waits until the IO becomes ready for the specified events and returns the
99359935
* subset of events that become ready, or a falsy value when times out.
99369936
*
99379937
* The events can be a bit mask of +IO::READABLE+, +IO::WRITABLE+ or
99389938
* +IO::PRIORITY+.
99399939
*
9940-
* Returns an event mask (truthy value) immediately when buffered data is available.
9940+
* Returns an event mask (truthy value) immediately when buffered data is
9941+
* available.
99419942
*
9942-
* Optional parameter +mode+ is one of +:read+, +:write+, or
9943-
* +:read_write+.
9943+
* The second form: if one or more event symbols (+:read+, +:write+, or
9944+
* +:read_write+) are passed, the event mask is the bit OR of the bitmask
9945+
* corresponding to those symbols. In this form, +timeout+ is optional, the
9946+
* order of the arguments is arbitrary, and returns +io+ if any of the
9947+
* events is ready.
99449948
*/
99459949

99469950
static VALUE
@@ -9950,10 +9954,6 @@ io_wait(int argc, VALUE *argv, VALUE io)
99509954
enum rb_io_event events = 0;
99519955
int return_io = 0;
99529956

9953-
// The documented signature for this method is actually incorrect.
9954-
// A single timeout is allowed in any position, and multiple symbols can be given.
9955-
// Whether this is intentional or not, I don't know, and as such I consider this to
9956-
// be a legacy/slow path.
99579957
if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) {
99589958
// We'd prefer to return the actual mask, but this form would return the io itself:
99599959
return_io = 1;

0 commit comments

Comments
 (0)