Class: Ahoy::BaseStore
- Inherits:
-
Object
- Object
- Ahoy::BaseStore
- Defined in:
- lib/ahoy/base_store.rb
Direct Known Subclasses
Instance Attribute Summary collapse
Instance Method Summary collapse
- #authenticate(data) ⇒ Object
- #exclude? ⇒ Boolean
- #generate_id ⇒ Object
- #geocode(data) ⇒ Object
-
#initialize(options) ⇒ BaseStore
constructor
A new instance of BaseStore.
- #track_event(data) ⇒ Object
- #track_visit(data) ⇒ Object
- #visit ⇒ Object
- #visit_or_create ⇒ Object
Constructor Details
#initialize(options) ⇒ BaseStore
Returns a new instance of BaseStore.
5 6 7 8 |
# File 'lib/ahoy/base_store.rb', line 5 def initialize() @user = [:user] @options = end |
Instance Attribute Details
#user ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ahoy/base_store.rb', line 25 def user @user ||= begin if Ahoy.user_method.respond_to?(:call) if Ahoy.user_method.arity == 1 Ahoy.user_method.call(controller) else Ahoy.user_method.call(controller, request) end else controller.send(Ahoy.user_method) if controller.respond_to?(Ahoy.user_method, true) end end end |
Instance Method Details
#authenticate(data) ⇒ Object
19 20 |
# File 'lib/ahoy/base_store.rb', line 19 def authenticate(data) end |
#exclude? ⇒ Boolean
39 40 41 42 43 |
# File 'lib/ahoy/base_store.rb', line 39 def exclude? (!Ahoy.track_bots && bot?) || exclude_by_method? || (defined?(Rails::HealthController) && controller.is_a?(Rails::HealthController)) end |
#generate_id ⇒ Object
45 46 47 |
# File 'lib/ahoy/base_store.rb', line 45 def generate_id Ahoy.token_generator.call end |
#geocode(data) ⇒ Object
16 17 |
# File 'lib/ahoy/base_store.rb', line 16 def geocode(data) end |
#track_event(data) ⇒ Object
13 14 |
# File 'lib/ahoy/base_store.rb', line 13 def track_event(data) end |
#track_visit(data) ⇒ Object
10 11 |
# File 'lib/ahoy/base_store.rb', line 10 def track_visit(data) end |
#visit ⇒ Object
22 23 |
# File 'lib/ahoy/base_store.rb', line 22 def visit end |
#visit_or_create ⇒ Object
49 50 51 |
# File 'lib/ahoy/base_store.rb', line 49 def visit_or_create visit end |