Module: Visitors

Extended by:
Visitors
Included in:
Visitors
Defined in:
lib/visitors.rb,
lib/visitors/version.rb

Defined Under Namespace

Classes: Config, Resource

Constant Summary collapse

VERSION =
'0.1.0'

Instance Method Summary collapse

Instance Method Details

#configObject



16
17
18
# File 'lib/visitors.rb', line 16

def config
  @config ||= Config.load
end

#envObject



12
13
14
# File 'lib/visitors.rb', line 12

def env
  ENV['RAILS_ENV'] || ENV['VISITORS_ENV'] || 'development'
end

#find(id) ⇒ Object



20
21
22
23
# File 'lib/visitors.rb', line 20

def find(id)
  return if Visitors.config.disabled
  Resource.find(id)
end

#increment(id, field) ⇒ Object



25
26
27
28
# File 'lib/visitors.rb', line 25

def increment(id, field)
  return if Visitors.config.disabled
  Resource.new(id).increment(field)
end