Module: Mongoid::Matcher::BitsAllClear Private
- Extended by:
- BitsAllClear
- Includes:
- Bits
- Included in:
- BitsAllClear
- Defined in:
- lib/mongoid/matcher/bits_all_clear.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
In-memory matcher for $bitsAllClear expression.
Instance Method Summary collapse
-
#array_matches?(value, condition) ⇒ true | false
private
Returns whether a position list condition matches a value.
-
#int_matches?(value, condition) ⇒ true | false
private
Returns whether a bitmask condition matches a value.
Methods included from Bits
Instance Method Details
#array_matches?(value, condition) ⇒ true | false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether a position list condition matches a value.
22 23 24 25 26 |
# File 'lib/mongoid/matcher/bits_all_clear.rb', line 22 def array_matches?(value, condition) condition.all? do |c| value & (1<<c) == 0 end end |
#int_matches?(value, condition) ⇒ true | false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether a bitmask condition matches a value.
36 37 38 |
# File 'lib/mongoid/matcher/bits_all_clear.rb', line 36 def int_matches?(value, condition) value & condition == 0 end |