Class: Drone::Metrics::Gauge
- Inherits:
-
Drone::Metric
- Object
- Drone::Metric
- Drone::Metrics::Gauge
- Defined in:
- lib/drone/metrics/gauge.rb
Overview
Gauge are linked to a block of code which will be called when the value is asked, the block is expected to return a number
Instance Attribute Summary
Attributes inherited from Drone::Metric
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Gauge
constructor
A new instance of Gauge.
- #value ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Gauge
Returns a new instance of Gauge.
13 14 15 16 17 |
# File 'lib/drone/metrics/gauge.rb', line 13 def initialize(name, &block) raise "Block expected" unless block super(name) @block = block end |
Instance Method Details
#value ⇒ Object
19 20 21 |
# File 'lib/drone/metrics/gauge.rb', line 19 def value @block.call() end |