Created Redistat::Result and started using it

Finder.

All specs pass.
This commit is contained in:
2010-10-18 23:41:28 +01:00
parent dce49f637c
commit 715d96db9c
4 changed files with 56 additions and 5 deletions

View File

@@ -27,6 +27,8 @@ module Redistat
total_sum.set_or_incr(k, v.to_i)
end
end
total_sum.date = Date.new(@options[:from], @options[:depth])
total_sum.till = Date.new(@options[:till], @options[:depth])
total_sum
end

14
lib/redistat/result.rb Normal file
View File

@@ -0,0 +1,14 @@
module Redistat
class Result < ::Hash
attr_accessor :date
attr_accessor :till
def set_or_incr(key, value)
self[key] = 0 if !self.has_key?(key)
self[key] += value
self
end
end
end