class Cabin::Metrics::Gauge

Public Class Methods

new(&block) click to toggle source

A new Gauge. The block given will be called every time the metric is read.

# File lib/cabin/metrics/gauge.rb, line 9
def initialize(&block)
  @inspectables = [ ]
  @block = block
end

Public Instance Methods

to_hash() click to toggle source
# File lib/cabin/metrics/gauge.rb, line 21
def to_hash
  return { :value => value }
end
value() click to toggle source

Get the value of this metric.

# File lib/cabin/metrics/gauge.rb, line 16
def value
  return @block.call
end