End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
StringIO#each_byte
each_byte {|byte| ... } → self
ext/stringio/stringio.c
View on GitHub ↗
static VALUE
strio_each_byte(VALUE self)
{
struct StringIO *ptr;
RETURN_ENUMERATOR(self, 0, 0);
while ((ptr = strio_to_read(self)) != NULL) {
char c = RSTRING_PTR(ptr->string)[ptr->pos++];
rb_yield(CHR2FIX(c));
}
return self;
}
With a block given, calls the block with each remaining byte in the stream; see Byte IO.
With no block given, returns an enumerator.