Module: HeapScope::Paths
- Defined in:
- lib/heapscope/paths.rb
Overview
Pretty retention-path formatting and reproduction helpers.
Class Method Summary collapse
Class Method Details
.format_tree(path) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/heapscope/paths.rb', line 8 def format_tree(path) return "Nearest observed retainer: unavailable" if path.nil? || Array(path.nodes).empty? lines = [] lines << "LIKELY RETENTION PATH (confidence: #{path.confidence})" lines << "Note: #{path.note}" if path.note Array(path.nodes).each_with_index do |node, idx| via = node[:via] || node["via"] || node[:note] || "ref" prefix = idx.zero? ? "" : "#{" " * idx}└── " lines << "#{prefix}#{via}" end lines.join("\n") end |