class CC::Workspace::Exclusion

Attributes

negated[R]
pattern[R]

Public Class Methods

new(pattern) click to toggle source
# File lib/cc/workspace/exclusion.rb, line 4
def initialize(pattern)
  @negated = pattern.starts_with?("!")
  @pattern = simplify(pattern)
end

Public Instance Methods

expand() click to toggle source
# File lib/cc/workspace/exclusion.rb, line 9
def expand
  if glob?
    Dir.glob(pattern)
  else
    [pattern]
  end
end
glob?() click to toggle source
# File lib/cc/workspace/exclusion.rb, line 17
def glob?
  pattern.include?("*")
end
negated?() click to toggle source
# File lib/cc/workspace/exclusion.rb, line 21
def negated?
  negated
end

Private Instance Methods

simplify(pattern) click to toggle source
# File lib/cc/workspace/exclusion.rb, line 29
def simplify(pattern)
  pattern.to_s.sub(%r{(/\*\*)?(/\*)?$}, "").sub(/^\!/, "")
end