-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Picking up the work left in #563. The most controversial part is the mismatch between what documentation says about return types and what actually gets returned (doc says bool, but IO or nil are actually returned).
- Loading branch information
1 parent
8b2ff98
commit 46b7b36
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class IO | ||
# Returns number of bytes that can be read without blocking. Returns zero if no | ||
# information available. | ||
# | ||
def nread: () -> Integer | ||
|
||
# Returns `true` if input available without blocking, or `false`. | ||
# | ||
def ready?: () -> (bool | self)? | ||
|
||
# Waits until the IO becomes ready for the specified events and returns the | ||
# subset of events that become ready, or `false` when times out. | ||
# | ||
# The events can be a bit mask of `IO::READABLE`, `IO::WRITABLE` or | ||
# `IO::PRIORITY`. | ||
# | ||
# Returns `true` immediately when buffered data is available. | ||
# | ||
# Optional parameter `mode` is one of `:read`, `:write`, or `:read_write` | ||
# (deprecated). | ||
# | ||
def wait: (Integer events, ?Numeric timeout) -> self? | ||
| (Integer timeout, ?(:read | :write | :read_write) mode) -> self? | ||
|
||
# Waits until IO is readable and returns `true`, or `false` when times out. | ||
# Returns `true` immediately when buffered data is available. | ||
# | ||
def wait_readable: (?Numeric timeout) -> self? | ||
|
||
# Waits until IO is writable and returns `true` or `false` when times out. | ||
# | ||
def wait_writable: (?Numeric timeout) -> self? | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters