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
nameString the name of the metric.
-
parameter
durationFloat | Nil the duration in milliseconds.
-
parameter
descriptionString | 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