From 48ebd77e595d569b225151ef281aae537d95d6f5 Mon Sep 17 00:00:00 2001 From: TOMITA Masahiro Date: Sun, 19 May 2024 20:21:15 +0900 Subject: [PATCH] Fix comment: Buffer.for(string) without block returns readonly buffer --- io_buffer.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/io_buffer.c b/io_buffer.c index 5210d4732b..e6ca61bdae 100644 --- a/io_buffer.c +++ b/io_buffer.c @@ -3572,25 +3572,23 @@ io_buffer_not_inplace(VALUE self) * \Buffer from string: * * string = 'data' - * buffer = IO::Buffer.for(string) - * # => - * # # - * # ... - * buffer - * # => - * # # - * # 0x00000000 64 61 74 61 data + * IO::Buffer.for(string) do |buffer| + * buffer + * # => + * # # + * # 0x00000000 64 61 74 61 data * - * buffer.get_string(2) # read content starting from offset 2 - * # => "ta" - * buffer.set_string('---', 1) # write content, starting from offset 1 - * # => 3 - * buffer - * # => - * # # - * # 0x00000000 64 2d 2d 2d d--- - * string # original string changed, too - * # => "d---" + * buffer.get_string(2) # read content starting from offset 2 + * # => "ta" + * buffer.set_string('---', 1) # write content, starting from offset 1 + * # => 3 + * buffer + * # => + * # # + * # 0x00000000 64 2d 2d 2d d--- + * string # original string changed, too + * # => "d---" + * end * * \Buffer from file: *