naive_bayes/resources/ruby/bit_vector.rb
# Serializes vector by encoding each symbol according to its mask
#
# @param buffer [IO] Buffer to receive the serialized vector
# @param value [Array<Symbol>] Array of flags to encode
# @return [IO] Buffer that received the serialized vector
Serializes vector by encoding each symbol according to its mask
Serializes vector by encoding each symbol according to its mask
def serialize(buffer, value)
          bits = 0
          value.each { |flag| bits |= @masks[flag] }
          buffer << [bits].pack(INT32_PACK)
        end
def serialize ( buffer , value ) bits = 0 value . each { | flag | bits |= @masks [ flag ] } buffer << [ bits ] . pack ( INT32_PACK ) end
Serializes vector by encoding each symbol according to its mask
Serializes vector by encoding each symbol according to its mask
Buffer that received the serialized vector
Buffer that received the serialized vector
IO
buffer
Buffer to receive the serialized vector
Buffer to receive the serialized vector
value
Array of flags to encode
Array of flags to encode