Class: PulseMeter::Sensor::HashedIndicator

Inherits:
Indicator show all
Defined in:
lib/pulse_meter/sensor/hashed_indicator.rb

Overview

Static hashed indicator. In fact is is just a named hash with float value

Constant Summary

Constants included from Mixins::Dumper

Mixins::Dumper::DUMP_REDIS_KEY

Instance Attribute Summary

Attributes inherited from Base

#name, #redis

Instance Method Summary collapse

Methods inherited from Indicator

#cleanup, #value_key

Methods inherited from Base

#annotate, #annotation, #cleanup, #command_aggregator, #event, #initialize

Methods included from Mixins::Dumper

included

Constructor Details

This class inherits a constructor from PulseMeter::Sensor::Base

Instance Method Details

#valueFixnum

Get indicator values

Returns:

  • (Fixnum)

    indicator value or zero unless it was initialized



8
9
10
11
12
# File 'lib/pulse_meter/sensor/hashed_indicator.rb', line 8

def value
  redis.
    hgetall(value_key).
    inject(Hash.new(0)) {|h, (k, v)| h[k] = v.to_f; h}
end