End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
IO::Buffer#~
~source → io_buffer
io_buffer.c
View on GitHub ↗
static VALUE
io_buffer_not(VALUE self)
{
struct rb_io_buffer *data = NULL;
TypedData_Get_Struct(self, struct rb_io_buffer, &rb_io_buffer_type, data);
VALUE output = rb_io_buffer_new(NULL, data->size, io_flags_for_size(data->size));
struct rb_io_buffer *output_data = NULL;
TypedData_Get_Struct(output, struct rb_io_buffer, &rb_io_buffer_type, output_data);
memory_not(output_data->base, data->base, data->size);
return output;
}
Generate a new buffer the same size as the source by applying the binary NOT operation to the source.
Example
~IO::Buffer.for("1234567890") # => # #<IO::Buffer 0x000055a5ac42f120+10 INTERNAL> # 0x00000000 ce cd cc cb ca c9 c8 c7 c6 cf ..........