Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

IO::Buffer#set_values

set_values(data_types, offset, values) → offset

Write values of data_types at offset to the buffer. data_types should be an array of symbols as described in get_value. values should be an array of values to write.

Example:

Example
buffer = IO::Buffer.new(8)
buffer.set_values([:U8, :U16], 0, [1, 2])
buffer
# =>
# #<IO::Buffer 0x696f717561746978+8 INTERNAL>
# 0x00000000  01 00 02 00 00 00 00 00                         ........
See also #set_value #shared? #set_string #size also in 4.1 · 4.0 · 3.4 · 3.3