зеркало из https://github.com/github/ruby.git
Fix IO::Buffer comment
This commit is contained in:
Родитель
8c0b57d3ee
Коммит
cb43540d53
14
io_buffer.c
14
io_buffer.c
|
@ -2441,13 +2441,13 @@ rb_io_buffer_initialize_copy(VALUE self, VALUE source)
|
||||||
*
|
*
|
||||||
* #copy can be used to put buffer into strings associated with buffer:
|
* #copy can be used to put buffer into strings associated with buffer:
|
||||||
*
|
*
|
||||||
* string= "buffer: "
|
* string= "data: "
|
||||||
* # => "buffer: "
|
* # => "data: "
|
||||||
* buffer = IO::Buffer.for(string)
|
* buffer = IO::Buffer.for(string)
|
||||||
* buffer.copy(IO::Buffer.for("test"), 5)
|
* buffer.copy(IO::Buffer.for("test"), 5)
|
||||||
* # => 4
|
* # => 4
|
||||||
* string
|
* string
|
||||||
* # => "buffer:test"
|
* # => "data:test"
|
||||||
*
|
*
|
||||||
* Attempt to copy into a read-only buffer will fail:
|
* Attempt to copy into a read-only buffer will fail:
|
||||||
*
|
*
|
||||||
|
@ -3571,7 +3571,7 @@ io_buffer_not_inplace(VALUE self)
|
||||||
*
|
*
|
||||||
* \Buffer from string:
|
* \Buffer from string:
|
||||||
*
|
*
|
||||||
* string = 'buffer'
|
* string = 'data'
|
||||||
* buffer = IO::Buffer.for(string)
|
* buffer = IO::Buffer.for(string)
|
||||||
* # =>
|
* # =>
|
||||||
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
||||||
|
@ -3579,7 +3579,7 @@ io_buffer_not_inplace(VALUE self)
|
||||||
* buffer
|
* buffer
|
||||||
* # =>
|
* # =>
|
||||||
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
* # #<IO::Buffer 0x00007f3f02be9b18+4 SLICE>
|
||||||
* # 0x00000000 64 61 74 61 buffer
|
* # 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"
|
||||||
|
@ -3594,7 +3594,7 @@ io_buffer_not_inplace(VALUE self)
|
||||||
*
|
*
|
||||||
* \Buffer from file:
|
* \Buffer from file:
|
||||||
*
|
*
|
||||||
* File.write('test.txt', 'test buffer')
|
* File.write('test.txt', 'test data')
|
||||||
* # => 9
|
* # => 9
|
||||||
* buffer = IO::Buffer.map(File.open('test.txt'))
|
* buffer = IO::Buffer.map(File.open('test.txt'))
|
||||||
* # =>
|
* # =>
|
||||||
|
@ -3611,7 +3611,7 @@ io_buffer_not_inplace(VALUE self)
|
||||||
* buffer.set_string('---', 1)
|
* buffer.set_string('---', 1)
|
||||||
* # => 3 -- bytes written
|
* # => 3 -- bytes written
|
||||||
* File.read('test.txt')
|
* File.read('test.txt')
|
||||||
* # => "t--- buffer"
|
* # => "t--- data"
|
||||||
*
|
*
|
||||||
* <b>The class is experimental and the interface is subject to change, this
|
* <b>The class is experimental and the interface is subject to change, this
|
||||||
* is especially true of file mappings which may be removed entirely in
|
* is especially true of file mappings which may be removed entirely in
|
||||||
|
|
Загрузка…
Ссылка в новой задаче