Class: GunDog::TraceExplorer

Inherits:
Object
  • Object
show all
Defined in:
lib/gun_dog/trace_explorer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_report) ⇒ TraceExplorer

Returns a new instance of TraceExplorer.



7
8
9
# File 'lib/gun_dog/trace_explorer.rb', line 7

def initialize(trace_report)
  @trace_report = trace_report
end

Instance Attribute Details

#trace_reportObject (readonly)

Returns the value of attribute trace_report.



5
6
7
# File 'lib/gun_dog/trace_explorer.rb', line 5

def trace_report
  @trace_report
end

Instance Method Details

#[](method_location) ⇒ Object



35
36
37
# File 'lib/gun_dog/trace_explorer.rb', line 35

def [](method_location)
  find_cache[method_location]
end

#call_countObject



47
48
49
# File 'lib/gun_dog/trace_explorer.rb', line 47

def call_count
  find_cache.each_pair.with_object({}) { |(k,v), memo| memo[k] = v.count }
end

#collaborating_classesObject



27
28
29
# File 'lib/gun_dog/trace_explorer.rb', line 27

def collaborating_classes
  @trace_report.collaborating_classes
end

#collaborating_local_classesObject



23
24
25
# File 'lib/gun_dog/trace_explorer.rb', line 23

def collaborating_local_classes
  @trace_report.collaborating_classes.select { |k| Utilities.local_locations_for_class(k).any? }
end

#cyclical_methodsObject



15
16
17
# File 'lib/gun_dog/trace_explorer.rb', line 15

def cyclical_methods
  @trace_report.call_records.select(&:cyclical?)
end

#internal_methodsObject



19
20
21
# File 'lib/gun_dog/trace_explorer.rb', line 19

def internal_methods
  @trace_report.call_records.select(&:internal?)
end

#methodsObject



39
40
41
# File 'lib/gun_dog/trace_explorer.rb', line 39

def methods
  find_cache.keys
end

#traceObject



31
32
33
# File 'lib/gun_dog/trace_explorer.rb', line 31

def trace
  @trace_report
end

#unique_call_signaturesObject



11
12
13
# File 'lib/gun_dog/trace_explorer.rb', line 11

def unique_call_signatures
  @trace_report.call_records.map(&:call_record_signature).uniq
end

#unique_traces(doc_name) ⇒ Object



43
44
45
# File 'lib/gun_dog/trace_explorer.rb', line 43

def unique_traces(doc_name)
  find_cache[doc_name].map { |cr| cr.stack&.map(&:to_s) }.uniq.compact
end