Class: Protocol::HTTP::Header::ServerTiming::Metric
- Inherits:
-
Struct
- Object
- Struct
- Protocol::HTTP::Header::ServerTiming::Metric
- Defined in:
- lib/protocol/http/header/server_timing.rb
Overview
A single metric in the Server-Timing header.
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, duration = nil, description = nil) ⇒ Metric
constructor
Create a new server timing metric.
-
#to_s ⇒ Object
Convert the metric to its string representation.
Constructor Details
#initialize(name, duration = nil, description = nil) ⇒ Metric
Create a new server timing metric.
39 40 41 |
# File 'lib/protocol/http/header/server_timing.rb', line 39 def initialize(name, duration = nil, description = nil) super(name, duration, description) end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
33 34 35 |
# File 'lib/protocol/http/header/server_timing.rb', line 33 def description @description end |
#duration ⇒ Object
Returns the value of attribute duration
33 34 35 |
# File 'lib/protocol/http/header/server_timing.rb', line 33 def duration @duration end |
#name ⇒ Object
Returns the value of attribute name
33 34 35 |
# File 'lib/protocol/http/header/server_timing.rb', line 33 def name @name end |
Instance Method Details
#to_s ⇒ Object
Convert the metric to its string representation.
46 47 48 49 50 51 |
# File 'lib/protocol/http/header/server_timing.rb', line 46 def to_s result = name.dup result << ";dur=#{duration}" if duration result << ";desc=\"#{description}\"" if description result end |