Method: StringIO#close_write
- Defined in:
- ext/stringio/stringio.c
#close_write ⇒ nil
Closes self for writing; closed-read setting remains unchanged.
Raises IOError if writing is attempted.
Related: StringIO#close, StringIO#close_read.
539 540 541 542 543 544 545 546 547 548 |
# File 'ext/stringio/stringio.c', line 539 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; } |