End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Integer#nobits?
nobits?(mask) → true or false
numeric.c
View on GitHub ↗
static VALUE
int_nobits_p(VALUE num, VALUE mask)
{
mask = rb_to_int(mask);
return int_zero_p(rb_int_and(num, mask));
}
Returns true if no bit that is set (=1) in mask is also set in self; returns false otherwise.
Example values:
0b11110000 self
0b00001111 mask
0b00000000 self & mask
true self.nobits?(mask)
0b00000001 self
0b11111111 mask
0b00000001 self & mask
false self.nobits?(mask)
Related: Integer#allbits?, Integer#anybits?.