Class: Visitor

Inherits:
Object
  • Object
show all
Defined in:
lib/wp-sessioniser/Visitor.rb

Overview

Visitor

Used to handle Visitor profiles in WPSessioniser

Category
Package

WPSessioniser

Author

Ryan McCoskrie <[email protected]>

License

MIT License

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeVisitor

Returns a new instance of Visitor.



15
16
17
# File 'lib/wp-sessioniser/Visitor.rb', line 15

def initialize
  @hits = Hash.new
end

Instance Attribute Details

#hitsObject (readonly)

Returns the value of attribute hits.



13
14
15
# File 'lib/wp-sessioniser/Visitor.rb', line 13

def hits
  @hits
end

Instance Method Details

#push_hit(page, date) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/wp-sessioniser/Visitor.rb', line 19

def push_hit(page, date)
  if @hits.has_key?(page)
    @hits[page].push(date)
  else
    @hits[page] = [date]
  end
end