Skip to content
instance method

IO::Buffer#each

each(buffer_type, [offset, [count]]) {|offset, value| ...} → self
each(buffer_type, [offset, [count]]) → enumerator

Iterates over the buffer, yielding each value of buffer_type starting from offset.

If count is given, only count values will be yielded.

Example
IO::Buffer.for("Hello World").each(:U8, 2, 2) do |offset, value|
  puts "#{offset}: #{value}"
end
# 2: 108
# 3: 108
See also #copy #each_byte #clear #empty? also in 4.1 · 3.4 · 3.3 · 3.2