Class XhochY::Drossellog::PageCounter
In: xhochy/drossellog/pagecounter.rb
Parent: Object
PageCounter EntryCounter ImpressionCounter DataCounter LogFileParser WeeklyReport CodeCounter MonthlyReport LogLine DailyReport DailyIPCounter IPCounter ImpressionBlacklist Drossellog XhochY dot/f_1.png

Counts all requests, even those which are not considered as an impression

Methods

add   from_hash   new   to_hash  

Attributes

pages  [R] 

Public Class methods

Create a new PageCounter instance

[Source]

    # File xhochy/drossellog/pagecounter.rb, line 30
30:       def initialize
31:         @pages = {}
32:       end

Public Instance methods

Count a request

[Source]

    # 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

import data from a Hash, overrides old data

[Source]

    # File xhochy/drossellog/pagecounter.rb, line 40
40:       def from_hash(data)
41:         @pages = data.clone
42:       end

Return the data of this object as a hash

[Source]

    # File xhochy/drossellog/pagecounter.rb, line 35
35:       def to_hash
36:         @pages.clone
37:       end

[Validate]