module Mongo::Protocol::Serializers::CString

MongoDB wire protocol serialization strategy for C style strings.

Serializes and de-serializes C style strings (null terminated).

Public Class Methods

serialize(buffer, value, validating_keys = BSON::Config.validating_keys?) click to toggle source

Serializes a C style string into the buffer

@param buffer [ String ] Buffer to receive the serialized CString. @param value [ String ] The string to be serialized.

@return [ String ] Buffer with serialized value.

# File lib/mongo/protocol/serializers.rb, line 79
def self.serialize(buffer, value, validating_keys = BSON::Config.validating_keys?)
  buffer.put_cstring(value)
end