Module: Stackprofiler::Filter::RemoveFramesHelper

Included in:
FrameRegexRemoval, GemRemoval, QuickMethodRemoval
Defined in:
lib/stackprofiler/utils.rb

Instance Method Summary collapse

Instance Method Details

#remove_frames(root, run) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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