lib/ahoy.rb in ahoy_matey-2.2.1 vs lib/ahoy.rb in ahoy_matey-3.0.0
- old
+ new
@@ -1,13 +1,14 @@
require "ipaddr"
+# dependencies
require "active_support"
require "active_support/core_ext"
-require "addressable/uri"
require "geocoder"
require "safely/core"
+# modules
require "ahoy/utils"
require "ahoy/base_store"
require "ahoy/controller"
require "ahoy/database_store"
require "ahoy/helper"
@@ -70,22 +71,24 @@
mattr_accessor :track_bots
self.track_bots = false
mattr_accessor :bot_detection_version
- self.bot_detection_version = 1
+ self.bot_detection_version = 2
mattr_accessor :token_generator
self.token_generator = -> { SecureRandom.uuid }
mattr_accessor :mask_ips
self.mask_ips = false
mattr_accessor :user_agent_parser
- self.user_agent_parser = :legacy
+ self.user_agent_parser = :device_detector
+ mattr_accessor :logger
+
def self.log(message)
- Rails.logger.info { "[ahoy] #{message}" }
+ logger.info { "[ahoy] #{message}" } if logger
end
def self.mask_ip(ip)
addr = IPAddr.new(ip)
if addr.ipv4?