module BSON::Array::ClassMethods
Public Instance Methods
from_bson(buffer, **options)
click to toggle source
Deserialize the array from BSON
.
@param [ ByteBuffer
] buffer The byte buffer.
@option options [ nil | :bson ] :mode Decoding mode to use.
@return [ Array
] The decoded array.
@see bsonspec.org/#/specification
@since 2.0.0
# File lib/bson/array.rb, line 117 def from_bson(buffer, **options) if buffer.respond_to?(:get_array) buffer.get_array(**options) else array = new buffer.get_int32 # throw away the length while (type = buffer.get_byte) != NULL_BYTE buffer.get_cstring array << BSON::Registry.get(type).from_bson(buffer, **options) end array end end