Class: Charted::Site

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/charted/model.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Site

Returns a new instance of Site.



33
34
35
36
# File 'lib/charted/model.rb', line 33

def initialize(*args)
  super
  self.created_at ||= DateTime.now
end

Instance Method Details



38
39
40
41
# File 'lib/charted/model.rb', line 38

def visitor_with_cookie(cookie)
  visitor = self.visitors_dataset[cookie.to_s.split('-').first.to_i]
  visitor && visitor.cookie == cookie ? visitor : nil
end