Module: Ahoy

Defined in:
app/jobs/ahoy/geocode_job.rb,
lib/ahoy.rb,
lib/ahoy/model.rb,
lib/ahoy/utils.rb,
lib/ahoy/engine.rb,
lib/ahoy/helper.rb,
lib/ahoy/tracker.rb,
lib/ahoy/version.rb,
lib/ahoy/base_store.rb,
lib/ahoy/controller.rb,
lib/ahoy/query_methods.rb,
lib/ahoy/database_store.rb,
lib/ahoy/visit_properties.rb,
app/jobs/ahoy/geocode_v2_job.rb,
lib/generators/ahoy/base_generator.rb,
app/controllers/ahoy/base_controller.rb,
lib/generators/ahoy/install_generator.rb,
lib/generators/ahoy/mongoid_generator.rb,
app/controllers/ahoy/events_controller.rb,
app/controllers/ahoy/visits_controller.rb,
lib/generators/ahoy/activerecord_generator.rb

Overview

for smooth update from Ahoy 1 -> 2 TODO remove in 5.0

Defined Under Namespace

Modules: Controller, Generators, Helper, Model, QueryMethods, Utils Classes: BaseController, BaseStore, DatabaseStore, Engine, EventsController, GeocodeJob, GeocodeV2Job, Tracker, VisitProperties, VisitsController

Constant Summary collapse

VERSION =
"4.1.0"
Properties =

backward compatibility

Ahoy::QueryMethods

Class Method Summary collapse

Class Method Details

.instanceObject



108
109
110
# File 'lib/ahoy.rb', line 108

def self.instance
  Thread.current[:ahoy]
end

.instance=(value) ⇒ Object



112
113
114
# File 'lib/ahoy.rb', line 112

def self.instance=(value)
  Thread.current[:ahoy] = value
end

.log(message) ⇒ Object



93
94
95
# File 'lib/ahoy.rb', line 93

def self.log(message)
  logger.info { "[ahoy] #{message}" } if logger
end

.mask_ip(ip) ⇒ Object



97
98
99
100
101
102
103
104
105
106
# File 'lib/ahoy.rb', line 97

def self.mask_ip(ip)
  addr = IPAddr.new(ip)
  if addr.ipv4?
    # set last octet to 0
    addr.mask(24).to_s
  else
    # set last 80 bits to zeros
    addr.mask(48).to_s
  end
end