class BSON::CodeWithScope
def to_bson(buffer = ByteBuffer.new)
- Since: - 2.0.0
Other tags:
- See: http://bsonspec.org/#/specification -
Returns:
-
(BSON::ByteBuffer)
- The buffer with the encoded object.
Other tags:
- Example: Encode the code with scope. -
def to_bson(buffer = ByteBuffer.new) position = buffer.length buffer.put_int32(0) buffer.put_string(javascript) scope.to_bson(buffer) buffer.replace_int32(position, buffer.length - position) end