Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
IO::Buffer#external?
() -> bool
external? → true or false
io_buffer.c
View on GitHub ↗
static VALUE
rb_io_buffer_external_p(VALUE self)
{
struct rb_io_buffer *buffer = NULL;
TypedData_Get_Struct(self, struct rb_io_buffer, &rb_io_buffer_type, buffer);
return RBOOL(buffer->flags & RB_IO_BUFFER_EXTERNAL);
}
The buffer is external if it references the memory which is not allocated or mapped by the buffer itself.
A buffer created using ::for has an external reference to the string’s memory.
External buffer can’t be resized.