module BSON::Hash
def to_bson(buffer = ByteBuffer.new)
- See: http://bsonspec.org/#/specification -
Returns:
-
(BSON::ByteBuffer)
- The buffer with the encoded object.
Other tags:
- Example: Get the hash as encoded BSON. -
def to_bson(buffer = ByteBuffer.new) # If the native buffer version has an optimized version, we'll call # it directly. Otherwise, we'll serialize the hash the hard way. if buffer.respond_to?(:put_hash) buffer.put_hash(self) else serialize_to_buffer(buffer) end end