lib/cc/workspace/exclusion.rb in codeclimate-0.33.0 vs lib/cc/workspace/exclusion.rb in codeclimate-0.34.0
- old
+ new
@@ -1,9 +1,10 @@
module CC
class Workspace
class Exclusion
def initialize(pattern)
+ @negated = pattern.starts_with?("!")
@pattern = simplify(pattern)
end
def expand
if glob?
@@ -15,15 +16,19 @@
def glob?
pattern.include?("*")
end
+ def negated?
+ negated
+ end
+
private
- attr_reader :pattern
+ attr_reader :negated, :pattern
def simplify(pattern)
- pattern.to_s.sub(%r{(/\*\*)?(/\*)?$}, "")
+ pattern.to_s.sub(%r{(/\*\*)?(/\*)?$}, "").sub(/^\!/, "")
end
end
end
end