summaryrefslogtreecommitdiff
path: root/io.rb
diff options
context:
space:
mode:
Diffstat (limited to 'io.rb')
-rw-r--r--io.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/io.rb b/io.rb
index 1b6dddf9e5..549c5e62bd 100644
--- a/io.rb
+++ b/io.rb
@@ -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