Class: GunDog::TraceExplorer
- Inherits:
-
Object
- Object
- GunDog::TraceExplorer
- Defined in:
- lib/gun_dog/trace_explorer.rb
Instance Attribute Summary collapse
-
#trace_report ⇒ Object
readonly
Returns the value of attribute trace_report.
Instance Method Summary collapse
- #[](method_location) ⇒ Object
- #call_count ⇒ Object
- #collaborating_classes ⇒ Object
- #collaborating_local_classes ⇒ Object
- #cyclical_methods ⇒ Object
-
#initialize(trace_report) ⇒ TraceExplorer
constructor
A new instance of TraceExplorer.
- #internal_methods ⇒ Object
- #methods ⇒ Object
- #trace ⇒ Object
- #unique_call_signatures ⇒ Object
- #unique_traces(doc_name) ⇒ Object
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_report ⇒ Object (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_count ⇒ Object
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_classes ⇒ Object
27 28 29 |
# File 'lib/gun_dog/trace_explorer.rb', line 27 def @trace_report. end |
#collaborating_local_classes ⇒ Object
23 24 25 |
# File 'lib/gun_dog/trace_explorer.rb', line 23 def @trace_report..select { |k| Utilities.local_locations_for_class(k).any? } end |
#cyclical_methods ⇒ Object
15 16 17 |
# File 'lib/gun_dog/trace_explorer.rb', line 15 def cyclical_methods @trace_report.call_records.select(&:cyclical?) end |
#internal_methods ⇒ Object
19 20 21 |
# File 'lib/gun_dog/trace_explorer.rb', line 19 def internal_methods @trace_report.call_records.select(&:internal?) end |
#methods ⇒ Object
39 40 41 |
# File 'lib/gun_dog/trace_explorer.rb', line 39 def methods find_cache.keys end |
#trace ⇒ Object
31 32 33 |
# File 'lib/gun_dog/trace_explorer.rb', line 31 def trace @trace_report end |
#unique_call_signatures ⇒ Object
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 |