| Class | XhochY::Drossellog::MonthlyReport |
| In: |
xhochy/drossellog/monthlyreport.rb
|
| Parent: | Object |
Creates a new WeeklyReport Object
# File xhochy/drossellog/monthlyreport.rb, line 15
15: def initialize
16: @unique_ipcounter = IPCounter.new
17: @daily_ipcounter = DailyIPCounter.new
18: @entrycounter = EntryCounter.new
19: @impressioncounter = ImpressionCounter.new
20: @requestcounter = PageCounter.new
21: @datacounter = DataCounter.new
22: @codecounter = CodeCounter.new
23: end
add the data of a daily report
# File xhochy/drossellog/monthlyreport.rb, line 40
40: def add_daily(day, data)
41: # we want the day as a integer between 0..6
42: if day.class == Time
43: day = day.wday
44: end
45:
46: @unique_ipcounter.add data.ipcounter
47: @daily_ipcounter.add day, data.ipcounter
48: @entrycounter.add data.entrycounter
49: @impressioncounter.add data.impressioncounter
50: @requestcounter.add data.requestcounter
51: @datacounter.add data.datacounter
52: @codecounter.add data.codecounter
53: end
Returns the data of that day as multidimensional a hash
# File xhochy/drossellog/monthlyreport.rb, line 26
26: def get_data
27: data = {
28: 'unique_ip' => @unique_ipcounter.to_hash,
29: 'daily_ip' => @daily_ipcounter.to_hash,
30: 'entrypages' => @entrycounter.to_hash,
31: 'impressions' => @impressioncounter.to_hash,
32: 'requests' => @requestcounter.to_hash,
33: 'data' => @datacounter.to_i,
34: 'codes' => @codecounter.to_hash,
35: 'codes_simple' => @codecounter.to_simple_hash
36: }
37: end