lib/covered/files.rb in covered-0.10.2 vs lib/covered/files.rb in covered-0.10.3
- old
+ new
@@ -115,11 +115,18 @@
@pattern = pattern
end
attr :pattern
- def accept? path
- !@pattern.match?(path)
+ if Regexp.instance_methods.include? :match?
+ # This is better as it doesn't allocate a MatchData instance which is essentially useless.
+ def accept? path
+ !@pattern.match?(path)
+ end
+ else
+ def accept? path
+ !(@pattern =~ path)
+ end
end
end
class Only < Filter
def initialize(output, pattern)