Skip to content
instance method

StringIO#eof

() -> bool
eof? -> true or false

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.