Method: Mongo::Protocol::Serializers::BitVector#initialize

Defined in:
lib/mongo/protocol/bit_vector.rb

#initialize(layout) ⇒ BitVector

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.

Initializes a BitVector with a layout

Parameters:

  • layout (Array<Symbol>)

    the array of fields in the bit vector



31
32
33
34
35
36
# File 'lib/mongo/protocol/bit_vector.rb', line 31

def initialize(layout)
  @masks = {}
  layout.each_with_index do |field, index|
    @masks[field] = 2**index if field
  end
end