Class: PulseMeter::Sensor::HashedIndicator
- 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
Instance Method Summary collapse
-
#event(events) ⇒ Object
Sets indicator values.
-
#value ⇒ Fixnum
Get indicator values.
Methods inherited from Indicator
Methods inherited from Base
#annotate, #annotation, #cleanup, #initialize
Methods included from Mixins::Dumper
Constructor Details
This class inherits a constructor from PulseMeter::Sensor::Base
Instance Method Details
#event(events) ⇒ Object
Sets indicator values
8 9 10 |
# File 'lib/pulse-meter/sensor/hashed_indicator.rb', line 8 def event(events) events.each_pair {|name, value| redis.hset(value_key, name, value.to_f)} end |
#value ⇒ Fixnum
Get indicator values
14 15 16 17 18 |
# File 'lib/pulse-meter/sensor/hashed_indicator.rb', line 14 def value redis. hgetall(value_key). inject(Hash.new(0)) {|h, (k, v)| h[k] = v.to_f; h} end |