module Mongo::Protocol::Serializers::Byte

MongoDB wire protocol serialization strategy for a single byte.

Writes and fetches a single byte from the byte buffer.

Public Class Methods

deserialize(buffer, options = {}) click to toggle source

Deserializes a byte from the byte buffer.

@param [ BSON::ByteBuffer ] buffer Buffer containing the value to read. @param [ Hash ] options This method currently accepts no options.

@return [ String ] The byte.

@since 2.5.0

# File lib/mongo/protocol/serializers.rb, line 426
def self.deserialize(buffer, options = {})
  buffer.get_byte
end
serialize(buffer, value, validating_keys = nil) click to toggle source

Writes a byte into the buffer.

@param [ BSON::ByteBuffer ] buffer Buffer to receive the single byte. @param [ String ] value The byte to write to the buffer. @param [ true, false ] validating_keys Whether to validate keys.

This option is deprecated and will not be used. It will removed in version 3.0.

@return [ BSON::ByteBuffer ] Buffer with serialized value.

@since 2.5.0

# File lib/mongo/protocol/serializers.rb, line 414
def self.serialize(buffer, value, validating_keys = nil)
  buffer.put_byte(value)
end