Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor the backtrace cleaner for greater clarity

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
  • Loading branch information...
commit 966c6ab0b6cf74d5b8b448db779134a9025a8b06 1 parent eeafa75
@samphippen authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 lib/rspec/core/backtrace_cleaner.rb
View
16 lib/rspec/core/backtrace_cleaner.rb
@@ -11,11 +11,17 @@ def initialize(include_patterns, discard_patterns)
end
def include?(line)
- if @include_patterns.any? {|p| line =~ p}
- return true
- else
- return not(@discard_patterns.any? {|p| line =~ p})
- end
+ matches_an_include_pattern? line or not matches_a_discard_pattern? line
+ end
+
+ private
+
+ def matches_an_include_pattern?(line)
+ @include_patterns.any? {|p| line =~ p}
+ end
+
+ def matches_a_discard_pattern?(line)
+ @discard_patterns.any? {|p| line =~ p}
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.