module Mongoid::Matcher::BitsAllSet
In-memory matcher for $bitsAllSet expression.
@see www.mongodb.com/docs/manual/reference/operator/query/bitsAllSet/
@api private
Public Instance Methods
array_matches?(value, condition)
click to toggle source
Returns whether a position list condition matches a value.
@param [ Object
] value The value to check. @param [ Array<Numeric> ] condition The position list condition.
@return [ true | false ] Whether the value matches.
@api private
# File lib/mongoid/matcher/bits_all_set.rb, line 22 def array_matches?(value, condition) condition.all? do |c| value & (1<<c) > 0 end end
int_matches?(value, condition)
click to toggle source
Returns whether a bitmask condition matches a value.
@param [ Object
] value The value to check. @param [ Numeric ] condition The bitmask condition.
@return [ true | false ] Whether the value matches.
@api private
# File lib/mongoid/matcher/bits_all_set.rb, line 36 def int_matches?(value, condition) value & condition == condition end