Class: ObjectTracer::Trackers::AssociactionCallTracker

Inherits:
ObjectTracer
  • Object
show all
Defined in:
lib/object_tracer/trackers/association_call_tracker.rb

Constant Summary

Constants inherited from ObjectTracer

CALLER_START_POINT, C_CALLER_START_POINT, VERSION

Instance Attribute Summary

Attributes inherited from ObjectTracer

#calls, #options, #target, #trace_point

Instance Method Summary collapse

Methods inherited from ObjectTracer

config, #create_child_device, #descendants, #initialize, #root_device, #set_block, #stop!, #stop_when, #track, #with

Methods included from Manageable

#delete_device, #devices, #reset!, #stop_all!, #suspend_new, #suspend_new!

Methods included from Output::Helpers

#and_output, #and_print, #and_write

Constructor Details

This class inherits a constructor from ObjectTracer

Instance Method Details

#filter_condition_satisfied?(tp) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/object_tracer/trackers/association_call_tracker.rb', line 8

def filter_condition_satisfied?(tp)
  return false unless is_from_target?(tp)

  model_class = target.class
  associations = model_class.reflections
  associations.keys.include?(tp.callee_id.to_s)
end

#validate_target!Object



4
5
6
# File 'lib/object_tracer/trackers/association_call_tracker.rb', line 4

def validate_target!
  raise NotAnActiveRecordInstanceError.new(target) unless target.is_a?(ActiveRecord::Base)
end