From 0ebb66541df6c4434e6864f2176986c573b7bc29 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Sat, 25 Oct 2025 21:37:46 +0100 Subject: [PATCH 1/2] Tweaks for StringIO#close_read --- ext/stringio/stringio.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index ca71bb48..5c5002e7 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -572,9 +572,14 @@ strio_close(VALUE self) * call-seq: * close_read -> nil * - * Closes +self+ for reading; closed-write setting remains unchanged. + * Closes +self+ for reading; returns +nil+: * - * Raises IOError if reading is attempted. + * strio = StringIO.new + * strio.closed_read? # => false + * strio.close_read # => nil + * strio.closed_read? # => true + * strio.closed_write? # => false + * strio.read # Raises IOError: not opened for reading * * Related: StringIO#close, StringIO#close_write. */ From 055198873ae23d788c2f08a0a59b788fa5e814fb Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Sun, 26 Oct 2025 12:25:47 -0500 Subject: [PATCH 2/2] Update stringio.c Restore remark about closed-write. --- ext/stringio/stringio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 5c5002e7..df7ac671 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -572,7 +572,9 @@ strio_close(VALUE self) * call-seq: * close_read -> nil * - * Closes +self+ for reading; returns +nil+: + * Closes +self+ for reading; + * closed-write setting remains unchanged; + * returns +nil+: * * strio = StringIO.new * strio.closed_read? # => false