Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/tty/reader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ def unbufferred(&block)
# whether to echo chars back or not, defaults to false
# @option [Boolean] raw
# whenther raw mode is enabled, defaults to true
# @option [Boolean] nonblock
# @option [Boolean, Numeric] nonblock
# whether to wait for input or not, defaults to false
# if it's Numeric, then use that for the timeout
#
# @return [String]
#
Expand Down
5 changes: 3 additions & 2 deletions lib/tty/reader/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ def initialize(input)
# whether to echo input back or not, defaults to true
# @param [Boolean] raw
# whether to use raw mode or not, defaults to false
# @param [Boolean] nonblock
# @param [Boolean, Numeric] nonblock
# whether to wait for input or not, defaults to false
# if it's Numeric, then use that for the timeout
#
# @return [String]
#
Expand All @@ -50,7 +51,7 @@ def get_char(echo: true, raw: false, nonblock: false)
mode.raw(raw) do
mode.echo(echo) do
if nonblock
input.wait_readable(TIMEOUT) ? input.getc : nil
input.wait_readable(nonblock.is_a?(Numeric) ? nonblock : TIMEOUT) ? input.getc : nil
else
input.getc
end
Expand Down