Permalink
Browse files

Refactor the backtrace cleaner for greater clarity

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
  • Loading branch information...
1 parent eeafa75 commit 966c6ab0b6cf74d5b8b448db779134a9025a8b06 @samphippen samphippen committed Mar 24, 2013
Showing with 11 additions and 5 deletions.
  1. +11 −5 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

0 comments on commit 966c6ab

Please sign in to comment.