Module: TrackerJacker::Trackable::ClassMethods

Defined in:
lib/tracker_jacker/trackable.rb

Instance Method Summary collapse

Instance Method Details

#analytic_attribute_tracking_callbacksObject



19
20
21
# File 'lib/tracker_jacker/trackable.rb', line 19

def analytic_attribute_tracking_callbacks
  @analytic_attribute_tracking_callbacks ||= {}
end

#analytic_event_tracking_callbacksObject



15
16
17
# File 'lib/tracker_jacker/trackable.rb', line 15

def analytic_event_tracking_callbacks
  @analytic_event_tracking_callbacks ||= {}
end

#track_attribute(attribute, options = {}) ⇒ Object



31
32
33
34
35
36
# File 'lib/tracker_jacker/trackable.rb', line 31

def track_attribute(attribute, options = {})
  owner_method = options.fetch(:owner)
  category = options.fetch(:category)

  analytic_attribute_tracking_callbacks[attribute] = AttributeTrackingCallback.new(attribute, owner_method, category)
end

#track_attributes(attributes, options = {}) ⇒ Object



38
39
40
# File 'lib/tracker_jacker/trackable.rb', line 38

def track_attributes(attributes, options = {})
  attributes.each {|attr| track_attribute(attr, options)}
end

#track_event(event, options = {}) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/tracker_jacker/trackable.rb', line 23

def track_event(event, options = {})
  if_proc = options.fetch(:if)
  owner_method = options.fetch(:owner)
  category = options.fetch(:category)

  analytic_event_tracking_callbacks[event] = EventTrackingCallback.new(event, if_proc, owner_method, category)
end