diff options
Diffstat (limited to 'io.rb')
| -rw-r--r-- | io.rb | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -60,7 +60,7 @@ class IO # return the symbol +:wait_readable+ instead. At EOF, it will return nil # instead of raising EOFError. def read_nonblock(len, buf = nil, exception: true) - __builtin_io_read_nonblock(len, buf, exception) + Primitive.io_read_nonblock(len, buf, exception) end # call-seq: @@ -118,6 +118,19 @@ class IO # that write_nonblock should not raise an IO::WaitWritable exception, but # return the symbol +:wait_writable+ instead. def write_nonblock(buf, exception: true) - __builtin_io_write_nonblock(buf, exception) + Primitive.io_write_nonblock(buf, exception) + end + + # call-seq: + # readline(sep = $/, chomp: false) -> string + # readline(limit, chomp: false) -> string + # readline(sep, limit, chomp: false) -> string + # + # Reads a line as with IO#gets, but raises EOFError if already at end-of-stream. + # + # Optional keyword argument +chomp+ specifies whether line separators + # are to be omitted. + def readline(sep = $/, limit = nil, chomp: false) + Primitive.io_readline(sep, limit, chomp) end end |
