Class: PulseMeter::Sensor::Indicator
- Defined in:
- lib/pulse_meter/sensor/indicator.rb
Overview
Static indicator. In fact is is just a named variable with float value
Direct Known Subclasses
Constant Summary
Constants included from Mixins::Dumper
Mixins::Dumper::DUMP_REDIS_KEY
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#cleanup ⇒ Object
Cleans up all sensor metadata in Redis.
-
#value ⇒ Fixnum
Get indicator value.
-
#value_key ⇒ String
Gets redis key by which counter value is stored.
Methods inherited from Base
#annotate, #annotation, #command_aggregator, #event, #initialize
Methods included from Mixins::Dumper
Constructor Details
This class inherits a constructor from PulseMeter::Sensor::Base
Instance Method Details
#cleanup ⇒ Object
Cleans up all sensor metadata in Redis
7 8 9 10 |
# File 'lib/pulse_meter/sensor/indicator.rb', line 7 def cleanup redis.del(value_key) super end |
#value ⇒ Fixnum
Get indicator value
14 15 16 17 |
# File 'lib/pulse_meter/sensor/indicator.rb', line 14 def value val = redis.get(value_key) val.nil? ? 0 : val.to_f end |
#value_key ⇒ String
Gets redis key by which counter value is stored
21 22 23 |
# File 'lib/pulse_meter/sensor/indicator.rb', line 21 def value_key @value_key ||= "pulse_meter:value:#{name}" end |