Protocol::HTTPSourceProtocolHTTPHeaderServerTimingMetric

class Metric

A single metric in the Server-Timing header.

Definitions

def initialize(name, duration = nil, description = nil)

Create a new server timing metric.

Signature

parameter name String

the name of the metric.

parameter duration Float | Nil

the duration in milliseconds.

parameter description String | Nil

the description of the metric.

Implementation

def initialize(name, duration = nil, description = nil)
	super(name, duration, description)
end

def to_s

Convert the metric to its string representation.

Signature

returns String

the formatted metric string.

Implementation

def to_s
	result = name.dup
	result << ";dur=#{duration}" if duration
	result << ";desc=\"#{description}\"" if description
	result
end