Skip to content
instance method

IO::Buffer#and!

source.and!(mask) → io_buffer

Modify the source buffer in place by applying the binary AND operation to the source, using the mask, repeating as necessary.

Example
source = IO::Buffer.for("1234567890").dup # Make a read/write copy.
# =>
# #<IO::Buffer 0x000056307a0d0c20+10 INTERNAL>
# 0x00000000  31 32 33 34 35 36 37 38 39 30                   1234567890

source.and!(IO::Buffer.for("\xFF\x00\x00\xFF"))
# =>
# #<IO::Buffer 0x000056307a0d0c20+10 INTERNAL>
# 0x00000000  31 00 00 34 35 00 00 38 39 00                   1..45..89.
See also #~ #clear #| #copy also in 4.1 · 3.4 · 3.3 · 3.2