Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- Library/Homebrew/extend/io.rb
Overview
typed: false frozen_string_literal: true
Instance Method Summary collapse
Instance Method Details
#readline_nonblock(sep = $INPUT_RECORD_SEPARATOR) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'Library/Homebrew/extend/io.rb', line 5 def readline_nonblock(sep = $INPUT_RECORD_SEPARATOR) line = +"" buffer = +"" loop do break if buffer == sep read_nonblock(1, buffer) line.concat(buffer) end line.freeze rescue IO::WaitReadable, EOFError => e raise e if line.empty? line.freeze end |