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#~

~source → io_buffer

Generate a new buffer the same size as the source by applying the unary 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 #| #advance #^ #and! also in 4.0 · 3.4 · 3.3 · 3.2