Class: RSpec::Core::BacktraceCleaner
- Inherits:
-
Object
- Object
- RSpec::Core::BacktraceCleaner
- Defined in:
- lib/rspec/core/backtrace_cleaner.rb
Constant Summary
- DEFAULT_EXCLUSION_PATTERNS =
[ /\/lib\d*\/ruby\//, /org\/jruby\//, /bin\//, %r|/gems/|, /spec\/spec_helper\.rb/, /lib\/rspec\/(core|expectations|matchers|mocks)/ ]
Instance Attribute Summary (collapse)
-
- (Object) exclusion_patterns
Returns the value of attribute exclusion_patterns.
-
- (Object) inclusion_patterns
Returns the value of attribute inclusion_patterns.
Instance Method Summary (collapse)
- - (Boolean) exclude?(line)
- - (Object) full_backtrace=(true_or_false)
- - (Boolean) full_backtrace?
-
- (BacktraceCleaner) initialize(inclusion_patterns = nil, exclusion_patterns = DEFAULT_EXCLUSION_PATTERNS.dup)
constructor
A new instance of BacktraceCleaner.
Constructor Details
- (BacktraceCleaner) initialize(inclusion_patterns = nil, exclusion_patterns = DEFAULT_EXCLUSION_PATTERNS.dup)
A new instance of BacktraceCleaner
17 18 19 20 21 22 23 24 25 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 17 def initialize(inclusion_patterns=nil, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup) @exclusion_patterns = exclusion_patterns if inclusion_patterns.nil? @inclusion_patterns = (matches_an_exclusion_pattern? Dir.getwd) ? [Regexp.new(Dir.getwd)] : [] else @inclusion_patterns = inclusion_patterns end end |
Instance Attribute Details
- (Object) exclusion_patterns
Returns the value of attribute exclusion_patterns
15 16 17 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 15 def exclusion_patterns @exclusion_patterns end |
- (Object) inclusion_patterns
Returns the value of attribute inclusion_patterns
14 15 16 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 14 def inclusion_patterns @inclusion_patterns end |
Instance Method Details
- (Boolean) exclude?(line)
27 28 29 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 27 def exclude?(line) @inclusion_patterns.none? {|p| line =~ p} and matches_an_exclusion_pattern?(line) end |
- (Object) full_backtrace=(true_or_false)
31 32 33 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 31 def full_backtrace=(true_or_false) @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup end |
- (Boolean) full_backtrace?
35 36 37 |
# File 'lib/rspec/core/backtrace_cleaner.rb', line 35 def full_backtrace? @exclusion_patterns.empty? end |