Class: Mocha::BacktraceFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/mocha/backtrace_filter.rb

Constant Summary collapse

LIB_DIRECTORY =
File.expand_path(File.join(File.dirname(__FILE__), "..")) + File::SEPARATOR

Instance Method Summary collapse

Constructor Details

#initialize(lib_directory = LIB_DIRECTORY) ⇒ BacktraceFilter

Returns a new instance of BacktraceFilter.



7
8
9
# File 'lib/mocha/backtrace_filter.rb', line 7

def initialize(lib_directory = LIB_DIRECTORY)
  @lib_directory = lib_directory
end

Instance Method Details

#filtered(backtrace) ⇒ Object



11
12
13
# File 'lib/mocha/backtrace_filter.rb', line 11

def filtered(backtrace)
  backtrace.reject { |location| Regexp.new(@lib_directory).match(File.expand_path(location)) }
end