mirror of
https://github.com/jimeh/redistat.git
synced 2026-02-19 05:16:39 +00:00
cleaner code for Redistat::Summary
This commit is contained in:
@@ -3,11 +3,13 @@ module Redistat
|
||||
include Database
|
||||
extend Database
|
||||
|
||||
DEPTHS = [:year, :month, :day, :hour, :min, :sec, :usec]
|
||||
|
||||
def self.update_all(key, stats = {}, depth_limit = nil)
|
||||
stats ||= {}
|
||||
depth_limit ||= key.depth
|
||||
return nil if stats.size == 0
|
||||
depths.each do |depth|
|
||||
DEPTHS.each do |depth|
|
||||
update(key, stats, depth)
|
||||
break if depth == depth_limit
|
||||
end
|
||||
@@ -21,9 +23,5 @@ module Redistat
|
||||
end
|
||||
end
|
||||
|
||||
def self.depths
|
||||
[:year, :month, :day, :hour, :min, :sec, :usec]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user