Class: Metric
- Inherits:
-
Object
- Object
- Metric
- Defined in:
- lib/rearview/templates/monitor.rb
Instance Attribute Summary collapse
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(label_fn, timestamp, value) ⇒ Metric
constructor
A new instance of Metric.
- #label ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(label_fn, timestamp, value) ⇒ Metric
Returns a new instance of Metric.
18 19 20 21 22 |
# File 'lib/rearview/templates/monitor.rb', line 18 def initialize(label_fn, , value) @label_fn = label_fn = @value = value end |
Instance Attribute Details
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
16 17 18 |
# File 'lib/rearview/templates/monitor.rb', line 16 def end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
16 17 18 |
# File 'lib/rearview/templates/monitor.rb', line 16 def value @value end |
Instance Method Details
#label ⇒ Object
24 25 26 |
# File 'lib/rearview/templates/monitor.rb', line 24 def label @label_fn.call end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/rearview/templates/monitor.rb', line 28 def to_s "{ label: #{label}, timestamp: #{timestamp}, value: #{value.nil? ? "nil" : value.to_f} }" end |