cleaner code for Redistat::Summary

This commit is contained in:
2010-07-24 21:04:05 +03:00
parent f8f2ece6e3
commit d7c343b371

View File

@@ -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