class RequireProf::TreePrinter
Private Instance Methods
print_result()
click to toggle source
# File lib/require_prof/printers/tree_printer.rb, line 10 def print_result @output << "#{@result.name}\n" print_trees(@result.children) end
print_trees(nodes, prefix = '')
click to toggle source
# File lib/require_prof/printers/tree_printer.rb, line 15 def print_trees(nodes, prefix = '') last = nodes.size - 1 nodes.each_with_index do |node, i| info = "#{node.name} (#{node.total_time.round(precision)} ms, #{node.total_memory.round} kb)\n" if i == last @output << "#{prefix}└── #{info}" print_trees(node.children, prefix + ' ') else @output << "#{prefix}├── #{info}" print_trees(node.children, prefix + '│ ') end end end