Skip to content
instance method

IO::Buffer#each_byte

each_byte([offset, [count]]) {|byte| ...} → self
each_byte([offset, [count]]) → enumerator

Iterates over the buffer, yielding each byte starting from offset.

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

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