Skip to content

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

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                   ..........
See also #| #and! #^ #clear also in 4.1 · 4.0 · 3.4 · 3.3