Module: Ahoy
- Defined in:
- 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/geocode_v2_job.rb,
lib/ahoy/visit_properties.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
Defined Under Namespace
Modules: Controller, Generators, Helper, Model, QueryMethods, Utils
Classes: BaseController, BaseStore, DatabaseStore, Engine, EventsController, GeocodeV2Job, Tracker, VisitProperties, VisitsController
Constant Summary
collapse
- VERSION =
"5.2.1"
- Properties =
Ahoy::QueryMethods
Class Method Summary
collapse
Class Method Details
.cookies=(value) ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/ahoy.rb', line 33
def self.cookies=(value)
if value == false
if defined?(Mongoid::Document) && defined?(Ahoy::Visit) && Ahoy::Visit < Mongoid::Document
raise <<~EOS
This feature requires a new index in Ahoy 5. Set:
class Ahoy::Visit
index({visitor_token: 1, started_at: 1})
end
Create the index before upgrading, and set:
Ahoy.cookies = :none
EOS
else
raise <<~EOS
This feature requires a new index in Ahoy 5. Create a migration with:
add_index :ahoy_visits, [:visitor_token, :started_at]
Run it before upgrading, and set:
Ahoy.cookies = :none
EOS
end
end
@@cookies = value
end
|
.cookies? ⇒ Boolean
129
130
131
|
# File 'lib/ahoy.rb', line 129
def self.cookies?
cookies && cookies != :none
end
|
.instance ⇒ Object
144
145
146
|
# File 'lib/ahoy.rb', line 144
def self.instance
Thread.current[:ahoy]
end
|
.instance=(value) ⇒ Object
148
149
150
|
# File 'lib/ahoy.rb', line 148
def self.instance=(value)
Thread.current[:ahoy] = value
end
|
.log(message) ⇒ Object
125
126
127
|
# File 'lib/ahoy.rb', line 125
def self.log(message)
logger.info { "[ahoy] #{message}" } if logger
end
|
.mask_ip(ip) ⇒ Object
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/ahoy.rb', line 133
def self.mask_ip(ip)
addr = IPAddr.new(ip)
if addr.ipv4?
addr.mask(24).to_s
else
addr.mask(48).to_s
end
end
|