Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
IO::Buffer#internal?
() -> bool
internal? → true or false
io_buffer.c
View on GitHub ↗
static VALUE
rb_io_buffer_internal_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_INTERNAL);
}
If the buffer is internal, meaning it references memory allocated by the buffer itself.
An internal buffer is not associated with any external memory (e.g. string) or file mapping.
Internal buffers are created using ::new and is the default when the requested size is less than the IO::Buffer::PAGE_SIZE and it was not requested to be mapped on creation.
Internal buffers can be resized, and such an operation will typically invalidate all slices, but not always.