Class: Harness::Gauge
- Inherits:
-
Measurement
- Object
- Measurement
- Harness::Gauge
- Defined in:
- lib/harness/gauge.rb
Instance Attribute Summary
Attributes inherited from Measurement
#id, #name, #source, #time, #units, #value
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Gauge
constructor
A new instance of Gauge.
Methods inherited from Measurement
Constructor Details
#initialize(attributes = {}) ⇒ Gauge
Returns a new instance of Gauge.
3 4 5 6 |
# File 'lib/harness/gauge.rb', line 3 def initialize(attributes = {}) super self.units ||= :ms end |
Class Method Details
.from_event(event) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/harness/gauge.rb', line 8 def self.from_event(event) if event.payload[:gauge].is_a? Hash gauge = new event.payload[:gauge] elsif event.payload[:gauge].is_a?(Symbol) || event.payload[:gauge].is_a?(String) gauge = new :id => event.payload[:gauge].to_s else gauge = new end gauge.id ||= event.name gauge.value = event.duration gauge end |