Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
IO::Buffer#readonly?
() -> bool
readonly? → true or false
io_buffer.c
View on GitHub ↗
static VALUE
io_buffer_readonly(VALUE self)
{
struct rb_io_buffer_view *buffer = get_io_buffer_view(self);
return RBOOL(io_buffer_readonly_p(buffer));
}
If the buffer is read only, meaning the buffer cannot be modified using set_value, set_string or copy and similar.
A buffer created by IO::Buffer.for without a block is read-only, as is one backed by a frozen string or a read-only file.
A slice derives read-only access from its current source. Replacing the source’s storage can therefore change the slice’s read-only status.