summaryrefslogtreecommitdiff
path: root/ext/stringio
diff options
context:
space:
mode:
authorJean byroot Boussier <[email protected]>2023-06-08 05:27:04 +0200
committerHiroshi SHIBATA <[email protected]>2023-08-02 18:18:17 +0900
commitfd8dd7199665ed26818a140de945cca71d6fc84b ()
tree01e7363f8c2ef43f62db5bf7ceb7d55b211821da /ext/stringio
parent201fd5751897618eb2a9a91f6f14241f0bad4744 (diff)
Implement StringIO#pread (#56)
Both for being closer to real IOs and also because it's a convenient API in multithreaded scenarios. Co-authored-by: Jean Boussier <[email protected]>
-rw-r--r--ext/stringio/stringio.c43
1 files changed, 43 insertions, 0 deletions
@@ -1584,6 +1584,48 @@ strio_read(int argc, VALUE *argv, VALUE self)
}
/*
* call-seq:
* strio.sysread(integer[, outbuf]) -> string
* strio.readpartial(integer[, outbuf]) -> string
@@ -1843,6 +1885,7 @@ Init_stringio(void)
rb_define_method(StringIO, "gets", strio_gets, -1);
rb_define_method(StringIO, "readlines", strio_readlines, -1);
rb_define_method(StringIO, "read", strio_read, -1);
rb_define_method(StringIO, "write", strio_write_m, -1);
rb_define_method(StringIO, "putc", strio_putc, 1);