Module: Mongoid::Matcher::BitsAnyClear Private

Extended by:
BitsAnyClear
Includes:
Bits
Included in:
BitsAnyClear
Defined in:
lib/mongoid/matcher/bits_any_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 $bitsAnyClear expression.

Instance Method Summary collapse

Methods included from Bits

#matches?, operator_name

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.

Parameters:

  • value (Object)

    The value to check.

  • condition (Array<Numeric>)

    The position list condition.

Returns:

  • (true | false)

    Whether the value matches.



22
23
24
25
26
# File 'lib/mongoid/matcher/bits_any_clear.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.

Parameters:

  • value (Object)

    The value to check.

  • condition (Numeric)

    The bitmask condition.

Returns:

  • (true | false)

    Whether the value matches.



36
37
38
# File 'lib/mongoid/matcher/bits_any_clear.rb', line 36

def int_matches?(value, condition)
  value & condition < condition
end