Class: BSON::Vector

Inherits:
Array
  • Object
show all
Defined in:
lib/bson/vector.rb

Overview

Vector of numbers along with metadata for binary interoperability.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, dtype, padding = 0) ⇒ Vector

be ignored when a vector element’s size is less than a byte and the length of the vector is not a multiple of 8.

Parameters:

  • data (::Array)

    The data to initialize the vector with.

  • dtype (Integer)

    The data type of the vector.

  • padding (Integer) (defaults to: 0)

    The number of bits in the final byte that are to



38
39
40
41
42
# File 'lib/bson/vector.rb', line 38

def initialize(data, dtype, padding = 0)
  @dtype = dtype
  @padding = padding
  super(data.dup)
end

Instance Attribute Details

#dtypeInteger (readonly)

Returns The data type stored in the vector.

Returns:

  • (Integer)

    The data type stored in the vector.



21
22
23
# File 'lib/bson/vector.rb', line 21

def dtype
  @dtype
end

#paddingInteger (readonly)

be ignored when a vector element’s size is less than a byte and the length of the vector is not a multiple of 8.

Returns:

  • (Integer)

    The number of bits in the final byte that are to



26
27
28
# File 'lib/bson/vector.rb', line 26

def padding
  @padding
end

Instance Method Details

#dataBSON::ByteBuffer

Returns The data in the vector.

Returns:



29
30
31
# File 'lib/bson/vector.rb', line 29

def data
  self
end