module ActionTracker::Concerns::Tracker
nodoc
Public Instance Methods
render(*args)
click to toggle source
Calls superclass method
# File lib/action_tracker/concerns/tracker.rb, line 15 def render(*args) conditional_track_event session[:action_tracked] = true super end
Private Instance Methods
conditional_track_event()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 23 def conditional_track_event track_event unless session[:action_tracked] end
digest()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 37 def digest return unless session[:action_tracker].present? session[:action_tracked] = true output = session[:action_tracker].flatten session[:action_tracker] = nil output end
find_resource()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 53 def find_resource @resource_method ||= Devise.mappings.keys.map { |resource| "current_#{resource}" } .select { |method_name| !method(method_name).call.nil? } .first || 'nil_current_resource' rescue NameError nil end
initialize_session()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 27 def initialize_session session[:action_tracked] = false end
namespace()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 75 def namespace self.class.name.deconstantize.try(:+, '::') end
nil_current_resource()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 79 def nil_current_resource NilResource.new end
resource()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 49 def resource @resource ||= method(find_resource).call if find_resource end
track_event()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 31 def track_event return unless ActionTracker.configuration.track_events session[:action_tracker] ||= [] session[:action_tracker] << tracker_params unless tracker_params.blank? end
tracker_exists?()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 71 def tracker_exists? tracker_instance && tracker_instance.respond_to?(action_name) end
tracker_instance()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 61 def tracker_instance @tracker_instance ||= tracker_klass.constantize.new(resource, self) rescue NameError nil end
tracker_klass()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 45 def tracker_klass @tracker_klass ||= "#{namespace}#{controller_name.camelize}Tracker" end
tracker_params()
click to toggle source
# File lib/action_tracker/concerns/tracker.rb, line 67 def tracker_params @tracker_params ||= tracker_exists? ? tracker_instance.method(action_name).call : nil end