Skip to content
instance method

StringIO#closed?

() -> bool
closed? → true or false

Returns whether self is closed for both reading and writing:

Example
strio = StringIO.new
strio.closed?     # => false  # Open for reading and writing.
strio.close_read
strio.closed?     # => false  # Still open for writing.
strio.close_write
strio.closed?     # => true   # Now closed for both.

Related: StringIO.closed_read?, StringIO.closed_write?.

See also #close #closed_read? #binmode #closed_write? also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0