| Class | XhochY::Drossellog::PageCounter |
| In: |
xhochy/drossellog/pagecounter.rb
|
| Parent: | Object |
Counts all requests, even those which are not considered as an impression
| pages | [R] |
Create a new PageCounter instance
# File xhochy/drossellog/pagecounter.rb, line 30
30: def initialize
31: @pages = {}
32: end
Count a request
# File xhochy/drossellog/pagecounter.rb, line 9
9: def add(page)
10: if page.class == PageCounter
11: page.pages.each do |path, value|
12: if @pages[path] == nil
13: @pages[path] = value
14: else
15: @pages[path] += value
16: end
17: end
18: end
19:
20: if page.class == String
21: if @pages[page] != nil
22: @pages[page] += 1
23: else
24: @pages[page] = 1
25: end
26: end #^ String
27: end