Fix comment: Buffer.for(string) without block returns readonly buffer
This commit is contained in:
parent
cb43540d53
commit
48ebd77e59
34
io_buffer.c
34
io_buffer.c
@ -3572,25 +3572,23 @@ io_buffer_not_inplace(VALUE self)
|
|||||||
* \Buffer from string:
|
* \Buffer from string:
|
||||||
*
|
*
|
||||||
* string = 'data'
|
* string = 'data'
|
||||||
* buffer = IO::Buffer.for(string)
|
* IO::Buffer.for(string) do |buffer|
|
||||||
* # =>
|
* buffer
|
||||||
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
* # =>
|
||||||
* # ...
|
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
||||||
* buffer
|
* # 0x00000000 64 61 74 61 data
|
||||||
* # =>
|
|
||||||
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
|
||||||
* # 0x00000000 64 61 74 61 data
|
|
||||||
*
|
*
|
||||||
* buffer.get_string(2) # read content starting from offset 2
|
* buffer.get_string(2) # read content starting from offset 2
|
||||||
* # => "ta"
|
* # => "ta"
|
||||||
* buffer.set_string('---', 1) # write content, starting from offset 1
|
* buffer.set_string('---', 1) # write content, starting from offset 1
|
||||||
* # => 3
|
* # => 3
|
||||||
* buffer
|
* buffer
|
||||||
* # =>
|
* # =>
|
||||||
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
||||||
* # 0x00000000 64 2d 2d 2d d---
|
* # 0x00000000 64 2d 2d 2d d---
|
||||||
* string # original string changed, too
|
* string # original string changed, too
|
||||||
* # => "d---"
|
* # => "d---"
|
||||||
|
* end
|
||||||
*
|
*
|
||||||
* \Buffer from file:
|
* \Buffer from file:
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user