1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/stringio] [DOC] Enhanced RDoc for StringIO

(https://github.com/ruby/stringio/pull/36)

Treats:
- #each_codepoint
- #gets
- #readline (shows up in doc for module IO::generic_readable, not class
StringIO)
- #each_line

https://github.com/ruby/stringio/commit/659aca7fe5
This commit is contained in:
Burdette Lamar 2022-10-21 09:12:31 -05:00 committed by git
parent f88bff7705
commit 35e03a44b8

View file

@ -1153,10 +1153,12 @@ strio_each_char(VALUE self)
/* /*
* call-seq: * call-seq:
* strio.each_codepoint {|c| block } -> strio * each_codepoint {|codepoint| ... } -> self
* strio.each_codepoint -> anEnumerator
* *
* See IO#each_codepoint. * With a block given, calls the block with each remaining codepoint in the stream;
* see {Codepoint IO}[rdoc-ref:io_streams.rdoc@Codepoint+IO].
*
* With no block given, returns an enumerator.
*/ */
static VALUE static VALUE
strio_each_codepoint(VALUE self) strio_each_codepoint(VALUE self)
@ -1366,11 +1368,13 @@ strio_getline(struct getline_arg *arg, struct StringIO *ptr)
/* /*
* call-seq: * call-seq:
* strio.gets(sep=$/, chomp: false) -> string or nil * gets(sep = $/, chomp: false) -> string or nil
* strio.gets(limit, chomp: false) -> string or nil * gets(limit, chomp: false) -> string or nil
* strio.gets(sep, limit, chomp: false) -> string or nil * gets(sep, limit, chomp: false) -> string or nil
* *
* See IO#gets. * Reads and returns a line from the stream;
* assigns the return value to <tt>$_</tt>;
* see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
*/ */
static VALUE static VALUE
strio_gets(int argc, VALUE *argv, VALUE self) strio_gets(int argc, VALUE *argv, VALUE self)
@ -1390,11 +1394,12 @@ strio_gets(int argc, VALUE *argv, VALUE self)
/* /*
* call-seq: * call-seq:
* strio.readline(sep=$/, chomp: false) -> string * readline(sep = $/, chomp: false) -> string
* strio.readline(limit, chomp: false) -> string or nil * readline(limit, chomp: false) -> string
* strio.readline(sep, limit, chomp: false) -> string or nil * readline(sep, limit, chomp: false) -> string
* *
* See IO#readline. * Reads a line as with IO#gets, but raises EOFError if already at end-of-file;
* see {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
*/ */
static VALUE static VALUE
strio_readline(int argc, VALUE *argv, VALUE self) strio_readline(int argc, VALUE *argv, VALUE self)
@ -1406,17 +1411,16 @@ strio_readline(int argc, VALUE *argv, VALUE self)
/* /*
* call-seq: * call-seq:
* strio.each(sep=$/, chomp: false) {|line| block } -> strio * each_line(sep = $/, chomp: false) {|line| ... } -> self
* strio.each(limit, chomp: false) {|line| block } -> strio * each_line(limit, chomp: false) {|line| ... } -> self
* strio.each(sep, limit, chomp: false) {|line| block } -> strio * each_line(sep, limit, chomp: false) {|line| ... } -> self
* strio.each(...) -> anEnumerator
* *
* strio.each_line(sep=$/, chomp: false) {|line| block } -> strio * Calls the block with each remaining line read from the stream;
* strio.each_line(limit, chomp: false) {|line| block } -> strio * does nothing if already at end-of-file;
* strio.each_line(sep, limit, chomp: false) {|line| block } -> strio * returns +self+.
* strio.each_line(...) -> anEnumerator * See {Line IO}[rdoc-ref:io_streams.rdoc@Line+IO].
* *
* See IO#each. * StringIO#each is an alias for StringIO#each_line.
*/ */
static VALUE static VALUE
strio_each(int argc, VALUE *argv, VALUE self) strio_each(int argc, VALUE *argv, VALUE self)