module Stackprofiler::Filter::RemoveFramesHelper

Public Instance Methods

remove_frames(root, run) { |node, frame| ... } click to toggle source
# File lib/stackprofiler/utils.rb, line 20
def remove_frames root, run
  root.reverse_depth_first do |node|
    frame = run.profile[:frames][node.name]

    if yield node, frame
      parent = node.parent
      node.remove_from_parent!

      node.children.each do |n|
        n.remove_from_parent!
        parent << n if parent[n.name].nil? # todo: have a think about if/why this "if" is necessary
      end
    end
  end
  root
end