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, frames) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/stackprofiler/utils.rb', line 32

def remove_frames root, frames
  root.reverse_depth_first do |node|
    frame = frames[node.name.to_i]

    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