Sha256: 865309149ee5cca8fa7d57419bfbfaafd6fe7c3ebac770d037c805870e99795c

Contents?: true

Size: 639 Bytes

Versions: 18

Compression:

Stored size: 639 Bytes

Contents

module PulseMeter
  module Sensor
    # Static hashed indicator. In fact is is just a named hash with float value
    class HashedIndicator < Indicator

      # Get indicator values
      # @return [Fixnum] indicator value or zero unless it was initialized
      def value
        redis.
          hgetall(value_key).
          inject(Hash.new(0)) {|h, (k, v)| h[k] = v.to_f; h}
      end

      private

      # Sets indicator values
      # @param value [Hash] new indicator values
      def process_event(events)
        events.each_pair {|name, value| command_aggregator.hset(value_key, name, value.to_f)}
      end

    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
pulse_meter_core-0.5.5 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.5.4 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.5.3 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.5.2 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.5.1 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.5.0 lib/pulse_meter/sensor/hashed_indicator.rb
pulse_meter_core-0.4.13 lib/pulse_meter/sensor/hashed_indicator.rb
pulse-meter-0.4.9 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.8 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.7 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.6 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.5 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.4 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.3 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.2 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.1 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.4.0 lib/pulse-meter/sensor/hashed_indicator.rb
pulse-meter-0.3.2 lib/pulse-meter/sensor/hashed_indicator.rb