Protocol::GRPCSourceProtocolGRPCHeaderEncoding

class Encoding

The grpc-encoding header represents the message compression encoding.

The grpc-encoding header specifies the compression algorithm used for the message payload. Common values include "identity" (no compression), "gzip", "deflate", etc. This header can appear in both request and response headers, but not in trailers.

Definitions

def self.parse(value)

Parse an encoding from a header value.

Signature

parameter value String

The header value to parse (e.g., "identity", "gzip").

returns Encoding

A new Encoding instance.

Implementation

def self.parse(value)
	new(value)
end

def self.coerce(value)

Coerce a value to an Encoding instance. Used by Protocol::HTTP::Headers when setting header values.

Signature

parameter value Object

The value to coerce (will be converted to string).

returns Encoding

A new Encoding instance.

Implementation

def self.coerce(value)
	new(value.to_s)
end

def initialize(value)

Initialize the encoding header with the given value.

Signature

parameter value String

The encoding value (e.g., "identity", "gzip").

Implementation

def initialize(value)
	super(value.to_s)
end

def identity?

Check if this encoding represents no compression (identity encoding).

Signature

returns Boolean

true if the encoding is "identity" or empty.

Implementation

def identity?
	self == "identity" || self.empty?
end

def <<(value)

Merge another encoding value (takes the new value, as encoding should only appear once)

Signature

parameter value String

The new encoding value

Implementation

def <<(value)
	replace(value.to_s)
	
	return self
end

def self.trailer?

Whether this header is acceptable in HTTP trailers. The grpc-encoding header does not appear in trailers.

Signature

returns Boolean

false, as grpc-encoding cannot appear in trailers.

Implementation

def self.trailer?
	false
end