Method: StringIO#close_write

Defined in:
stringio.c

#close_writenil

Closes the write end of a StringIO. Will raise an IOError if the receiver is not writeable.

Returns:

  • (nil)


544
545
546
547
548
549
550
551
552
553
# File 'stringio.c', line 544

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;
}