From 2d47d21c5c2f792a52677328f8f5fe5706becb19 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 22 Oct 2025 00:33:41 +0100 Subject: [PATCH 1/2] [DOC] TWeaks for StringIO.open --- ext/stringio/stringio.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index aaf008ad..19fd7ddd 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -370,23 +370,21 @@ strio_finalize(VALUE self) /* * call-seq: - * StringIO.open(string = '', mode = 'r+') {|strio| ... } + * self.open(string = '', mode = 'r+') -> new_stringio + * self.open(string = '', mode = 'r+') {|strio| ... } -> object * - * Note that +mode+ defaults to 'r' if +string+ is frozen. - * - * Creates a new \StringIO instance formed from +string+ and +mode+; - * see {Access Modes}[rdoc-ref:File@Access+Modes]. + * Creates new \StringIO instance by calling StringIO.new(string, mode); + * see StringIO.new. * - * With no block, returns the new instance: + * With no block given, returns the new instance: * * strio = StringIO.open # => # * - * With a block, calls the block with the new instance - * and returns the block's value; - * closes the instance on block exit. + * With a block given, calls the block with the new instance, + * closes the instance on block exit, + * and returns the block's value: * - * StringIO.open {|strio| p strio } - * # => # + * StringIO.open('foo') {|strio| strio.string.upcase } # => "FOO" * * Related: StringIO.new. */ From f2a54998940630f57501f1818e44bf20b69a4625 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 22 Oct 2025 16:20:43 +0100 Subject: [PATCH 2/2] [DOC] Tweaks for StringIO.open --- ext/stringio/stringio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index 19fd7ddd..5212c2d0 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -370,19 +370,18 @@ strio_finalize(VALUE self) /* * call-seq: - * self.open(string = '', mode = 'r+') -> new_stringio - * self.open(string = '', mode = 'r+') {|strio| ... } -> object + * StringIO.open(string = '', mode = 'r+') -> new_stringio + * StringIO.open(string = '', mode = 'r+') {|strio| ... } -> object * - * Creates new \StringIO instance by calling StringIO.new(string, mode); - * see StringIO.new. + * Creates new \StringIO instance by calling StringIO.new(string, mode). * * With no block given, returns the new instance: * * strio = StringIO.open # => # * - * With a block given, calls the block with the new instance, - * closes the instance on block exit, - * and returns the block's value: + * With a block given, calls the block with the new instance + * and returns the block's value; + * closes the instance on block exit: * * StringIO.open('foo') {|strio| strio.string.upcase } # => "FOO" *