| Class | XhochY::Drossellog::IPCounter |
| In: |
xhochy/drossellog/ipcounter.rb
|
| Parent: | Object |
| users | [R] | The users(IP adresses) which made requests |
Count another user, users are identified by their IP Input could be as String(1 Access), Hash and IPCounter(many users)
# File xhochy/drossellog/ipcounter.rb, line 34
34: def add(data)
35: if data.class == Hash
36: # data is a Hash, so iterate through it
37: data.each do |ip, value|
38: if @users[ip] == nil
39: @users[ip] = value
40: else
41: @users[ip] += value
42: end
43: end
44: end #^ Hash
45:
46: if data.class == IPCounter
47: data.users.each do |ip, value|
48: if @users[ip] == nil
49: @users[ip] = value
50: else
51: @users[ip] += value
52: end
53: end
54: end #^ IPCounter
55:
56: if data.class == String
57: if @users[data] == nil
58: @users[data] = 1
59: else
60: @users[data] += 1
61: end
62: end #^ String
63: end
Count another user, users are identified by their IP
# File xhochy/drossellog/ipcounter.rb, line 14
14: def add_user(ip)
15: if @users[ip] != nil
16: @users[ip] += 1
17: else
18: @users[ip] = 1
19: end
20: end