instance method
StringIO#eof
() -> bool
eof? -> true or false
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_eof(VALUE self)
{
if (strio_to_read(self)) return Qfalse;
return Qtrue;
}
Returns whether self is positioned at end-of-stream:
Example
strio = StringIO.new('foo') strio.pos # => 0 strio.eof? # => false strio.read # => "foo" strio.pos # => 3 strio.eof? # => true strio.close_read strio.eof? # Raises IOError: not opened for reading
Related: StringIO#pos.
See also
#eof?
#each_line
#each_codepoint
#external_encoding
also in
4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0