Sha256: 60d56e9acee0b6bcfb6f39b10e6642467dc244960550508cb9815d91ee7ebeb5
Contents?: true
Size: 825 Bytes
Versions: 18
Compression:
Stored size: 825 Bytes
Contents
module PulseMeter module Sensor # Static indicator. In fact is is just a named variable with float value class Indicator < Base # Cleans up all sensor metadata in Redis def cleanup redis.del(value_key) super end # Get indicator value # @return [Fixnum] indicator value or zero unless it was initialized def value val = redis.get(value_key) val.nil? ? 0 : val.to_f end # Gets redis key by which counter value is stored # @return [String] def value_key @value_key ||= "pulse_meter:value:#{name}" end private # Sets indicator value # @param value [Float] new indicator value def process_event(value) command_aggregator.set(value_key, value.to_f) end end end end
Version data entries
18 entries across 18 versions & 2 rubygems