Class: Stackprofiler::Filter::FrameRegexRemoval

Inherits:
Object
  • Object
show all
Includes:
RemoveFramesHelper
Defined in:
lib/stackprofiler/filters/frame_regex_removal.rb

Instance Method Summary collapse

Methods included from RemoveFramesHelper

#remove_frames

Constructor Details

#initialize(options = {}) ⇒ FrameRegexRemoval

Returns a new instance of FrameRegexRemoval.



6
7
8
# File 'lib/stackprofiler/filters/frame_regex_removal.rb', line 6

def initialize(options={})
  @options = options
end

Instance Method Details

#filter(root, run) ⇒ Object



15
16
17
18
19
# File 'lib/stackprofiler/filters/frame_regex_removal.rb', line 15

def filter root, run
  remove_frames root, run do |node, frame|
    regexes.any? {|r| frame[:name] =~ r }
  end
end

#regexesObject



10
11
12
13
# File 'lib/stackprofiler/filters/frame_regex_removal.rb', line 10

def regexes
  ary = @options[:regexes] || []
  @regexes ||= ary.reject(&:blank?).map {|r| /#{r}/ }.compact
end