Module: Mongoid::Matcher::BitsAnySet Private
- Extended by:
- BitsAnySet
- Includes:
- Bits
- Included in:
- BitsAnySet
- Defined in:
- lib/mongoid/matcher/bits_any_set.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 $bitsAnySet 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_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
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_any_set.rb', line 36 def int_matches?(value, condition) value & condition > 0 end |