Methods

BSON::Array::ClassMethods

Public Instance Methods

from_bson(bson) click to toggle source

Deserialize the array from BSON.

@param [ BSON ] bson The bson representing an array.

@return [ Array ] The decoded array.

@see bsonspec.org/#/specification

@since 2.0.0

# File lib/bson/array.rb, line 82
def from_bson(bson)
  array = new
  bson.read(4) # throw away the length
  while (type = bson.readbyte.chr) != NULL_BYTE
    bson.gets(NULL_BYTE)
    array << BSON::Registry.get(type).from_bson(bson)
  end
  array
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.