summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdette Lamar <BurdetteLamar@Yahoo.com>2025-10-22 19:51:40 -0500
committergit <svn-admin@ruby-lang.org>2025-10-23 00:52:17 +0000
commitf762e50bcbfca76b3f710bede6a29d82d308b897 (patch)
tree9a9508912b5a0c16e7ba41b4f36af501f57902ea
parent4368e6c42effc16904e35f753fc2002f0bba375a (diff)
[ruby/stringio] [DOC] Tweaks for StringIO.open
(https://github.com/ruby/stringio/pull/146) https://github.com/ruby/stringio/commit/141c6c0edf
-rw-r--r--ext/stringio/stringio.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 0493c8cd50..ce7398bb83 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -370,23 +370,20 @@ strio_finalize(VALUE self)
/*
* call-seq:
- * StringIO.open(string = '', mode = 'r+') {|strio| ... }
+ * StringIO.open(string = '', mode = 'r+') -> new_stringio
+ * StringIO.open(string = '', mode = 'r+') {|strio| ... } -> object
*
- * Note that +mode+ defaults to <tt>'r'</tt> 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 <tt>StringIO.new(string, mode)</tt>.
*
- * With no block, returns the new instance:
+ * With no block given, returns the new instance:
*
* strio = StringIO.open # => #<StringIO>
*
- * With a block, calls the block with the new instance
+ * With a block given, calls the block with the new instance
* and returns the block's value;
- * closes the instance on block exit.
+ * closes the instance on block exit:
*
- * StringIO.open {|strio| p strio }
- * # => #<StringIO>
+ * StringIO.open('foo') {|strio| strio.string.upcase } # => "FOO"
*
* Related: StringIO.new.
*/