Sha256: 234dc69a07083ca1ab5ae3bef8efd55dbb9f217c5060bc1a62df730af39242b5

Contents?: true

Size: 768 Bytes

Versions: 155

Compression:

Stored size: 768 Bytes

Contents

module CC
  class Workspace
    autoload :Exclusion, "cc/workspace/exclusion"
    autoload :PathTree, "cc/workspace/path_tree"

    def initialize(path_tree = PathTree.for_path("."))
      @path_tree = path_tree
    end

    def clone
      self.class.new(path_tree.clone)
    end

    def paths
      path_tree.all_paths
    end

    def add(paths)
      if paths.present?
        path_tree.include_paths(paths)
      end
    end

    def remove(patterns)
      Array(patterns).each do |pattern|
        exclusion = Exclusion.new(pattern)
        if exclusion.negated?
          path_tree.include_paths(exclusion.expand)
        else
          path_tree.exclude_paths(exclusion.expand)
        end
      end
    end

    private

    attr_reader :path_tree
  end
end

Version data entries

155 entries across 155 versions & 2 rubygems

Version Path
codeclimate-0.85.27 lib/cc/workspace.rb
codeclimate-0.85.26 lib/cc/workspace.rb
codeclimate-0.85.25 lib/cc/workspace.rb
codeclimate-0.85.24 lib/cc/workspace.rb
codeclimate-fede-0.85.54 lib/cc/workspace.rb
codeclimate-fede-0.85.53 lib/cc/workspace.rb
codeclimate-fede-0.85.52 lib/cc/workspace.rb
codeclimate-fede-0.85.51 lib/cc/workspace.rb
codeclimate-fede-0.85.50 lib/cc/workspace.rb
codeclimate-fede-0.85.49 lib/cc/workspace.rb
codeclimate-fede-0.85.48 lib/cc/workspace.rb
codeclimate-fede-0.85.47 lib/cc/workspace.rb
codeclimate-fede-0.85.46 lib/cc/workspace.rb
codeclimate-fede-0.85.45 lib/cc/workspace.rb
codeclimate-fede-0.85.44 lib/cc/workspace.rb
codeclimate-fede-0.85.43 lib/cc/workspace.rb
codeclimate-fede-0.85.42 lib/cc/workspace.rb
codeclimate-fede-0.85.41 lib/cc/workspace.rb
codeclimate-fede-0.85.40 lib/cc/workspace.rb
codeclimate-fede-0.85.39 lib/cc/workspace.rb