Method: Mongo::Protocol::Serializers::Bytes.serialize

Defined in:
lib/mongo/protocol/serializers.rb

.serialize(buffer, value, validating_keys = BSON::Config.validating_keys?) ⇒ BSON::ByteBuffer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Writes bytes into the buffer.

Parameters:

  • buffer (BSON::ByteBuffer)

    Buffer to receive the bytes.

  • value (String)

    The bytes to write to the buffer.

  • validating_keys (true, false) (defaults to: BSON::Config.validating_keys?)

    Whether to validate keys.

Returns:

  • (BSON::ByteBuffer)

    Buffer with serialized value.

Since:

  • 2.5.0



439
440
441
# File 'lib/mongo/protocol/serializers.rb', line 439

def self.serialize(buffer, value, validating_keys = BSON::Config.validating_keys?)
  buffer.put_bytes(value)
end