Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
StringIO#close_write
close_write → nil
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_close_write(VALUE self)
{
struct StringIO *ptr = StringIO(self);
if (!(ptr->flags & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "closing non-duplex IO for writing");
}
RBASIC(self)->flags &= ~STRIO_WRITABLE;
return Qnil;
}
Closes self for writing; closed-read setting remains unchanged.
Raises IOError if writing is attempted.
Related: StringIO#close, StringIO#close_read.