Class: Drone::Metrics::Counter
- Inherits:
-
Drone::Metric
- Object
- Drone::Metric
- Drone::Metrics::Counter
- Defined in:
- lib/drone/metrics/counter.rb
Overview
A Counter store a number which can go up or down, the counter can change a counter value with the methods increment and decrement aliased as inc and dec
Instance Attribute Summary
Attributes inherited from Drone::Metric
Instance Method Summary collapse
- #clear ⇒ Object
- #decrement(n = 1) ⇒ Object (also: #dec)
- #increment(n = 1) ⇒ Object (also: #inc)
-
#initialize(name, initial_value = 0) ⇒ Counter
constructor
A new instance of Counter.
- #value ⇒ Object
Constructor Details
Instance Method Details
#clear ⇒ Object
34 35 36 |
# File 'lib/drone/metrics/counter.rb', line 34 def clear @value.set(0) end |
#decrement(n = 1) ⇒ Object Also known as: dec
29 30 31 |
# File 'lib/drone/metrics/counter.rb', line 29 def decrement(n = 1) @value.dec(n) end |
#increment(n = 1) ⇒ Object Also known as: inc
24 25 26 |
# File 'lib/drone/metrics/counter.rb', line 24 def increment(n = 1) @value.inc(n) end |
#value ⇒ Object
20 21 22 |
# File 'lib/drone/metrics/counter.rb', line 20 def value @value.get end |