Skip to content

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

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.

See also #read #set_string #pwrite #set_value also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1