Class: Cabin::Metrics::Gauge

Inherits:
Object
  • Object
show all
Includes:
Cabin::Metric
Defined in:
lib/cabin/metrics/gauge.rb

Instance Method Summary collapse

Methods included from Cabin::Metric

#emit, #instance, #instance=

Methods included from Publisher

#channel, #channel=, #publish

Methods included from Inspectable

#inspect

Constructor Details

#initialize(&block) ⇒ Gauge

Returns a new instance of Gauge.


9
10
11
12
# File 'lib/cabin/metrics/gauge.rb', line 9

def initialize(&block)
  @inspectables = [ ]
  @block = block
end

Instance Method Details

#to_hashObject


21
22
23
# File 'lib/cabin/metrics/gauge.rb', line 21

def to_hash
  return { :value => value }
end

#valueObject


16
17
18
# File 'lib/cabin/metrics/gauge.rb', line 16

def value
  return @block.call
end