Sha256: 4c2db688ce2dd0030f3510176f25c64a93cbc0ac2a50c6b5fbd03a23324b69f3

Contents?: true

Size: 507 Bytes

Versions: 4

Compression:

Stored size: 507 Bytes

Contents

module Redistat
  class Summary
    include Database
    
    def self.update_all(key, stats = {}, depth_limit = nil)
      stats ||= {}
      depth_limit ||= key.depth
      return nil if stats.size == 0
      Date::DEPTHS.each do |depth|
        update(key, stats, depth)
        break if depth == depth_limit
      end
    end
    
    private
    
    def self.update(key, stats, depth)
      stats.each do |field, value|
        db.hincrby key.to_s(depth), field, value
      end
    end
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redistat-0.0.4 lib/redistat/summary.rb
redistat-0.0.3 lib/redistat/summary.rb
redistat-0.0.2 lib/redistat/summary.rb
redistat-0.0.1 lib/redistat/summary.rb