Module: Mongoid::Matcher::BitsAnySet Private
Do not use. This module is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Bits
|
|
Defined in: | lib/mongoid/matcher/bits_any_set.rb |
Overview
In-memory matcher for $bitsAnySet expression.
Instance Method Summary
-
#array_matches?(value, condition) ⇒ true | false
Internal use only
Returns whether a position list condition matches a value.
-
#int_matches?(value, condition) ⇒ true | false
Internal use only
Returns whether a bitmask condition matches a value.
Bits
- Included
#matches? | Returns whether a value satisfies a bitwise expression. |
Instance Method Details
#array_matches?(value, condition) ⇒ true
| false
Returns whether a position list condition matches a value.
# File 'lib/mongoid/matcher/bits_any_set.rb', line 22
def array_matches?(value, condition) condition.any? do |c| value & (1<<c) > 0 end end
#int_matches?(value, condition) ⇒ true
| false
Returns whether a bitmask condition matches a value.
# File 'lib/mongoid/matcher/bits_any_set.rb', line 36
def int_matches?(value, condition) value & condition > 0 end