Skip to content

Commit 5034156

Browse files
[DOC] Tweaks for StringIO#eof? (#160)
1 parent 3562c34 commit 5034156

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

ext/stringio/stringio.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,18 @@ strio_to_read(VALUE self)
699699
* call-seq:
700700
* eof? -> true or false
701701
*
702-
* Returns +true+ if positioned at end-of-stream, +false+ otherwise;
703-
* see {Position}[rdoc-ref:IO@Position].
702+
* Returns whether +self+ is positioned at end-of-stream:
703+
*
704+
* strio = StringIO.new('foo')
705+
* strio.pos # => 0
706+
* strio.eof? # => false
707+
* strio.read # => "foo"
708+
* strio.pos # => 3
709+
* strio.eof? # => true
710+
* strio.close_read
711+
* strio.eof? # Raises IOError: not opened for reading
704712
*
705-
* Raises IOError if the stream is not opened for reading.
713+
* Related: StringIO#pos.
706714
*/
707715
static VALUE
708716
strio_eof(VALUE self)

0 commit comments

Comments
 (0)