Sha256: ffca691068dbf779ea32605f615641789220559f705478ec67399e0e4a8f5cdb

Contents?: true

Size: 566 Bytes

Versions: 155

Compression:

Stored size: 566 Bytes

Contents

module CC
  class Workspace
    class Exclusion
      def initialize(pattern)
        @negated = pattern.starts_with?("!")
        @pattern = simplify(pattern)
      end

      def expand
        if glob?
          Dir.glob(pattern)
        else
          [pattern]
        end
      end

      def glob?
        pattern.include?("*")
      end

      def negated?
        negated
      end

      private

      attr_reader :negated, :pattern

      def simplify(pattern)
        pattern.to_s.sub(%r{(/\*\*)?(/\*)?$}, "").sub(/^\!/, "")
      end
    end
  end
end

Version data entries

155 entries across 155 versions & 2 rubygems

Version Path
codeclimate-0.96.0 lib/cc/workspace/exclusion.rb
codeclimate-0.95.0 lib/cc/workspace/exclusion.rb
codeclimate-0.94.1 lib/cc/workspace/exclusion.rb
codeclimate-0.94.0 lib/cc/workspace/exclusion.rb
codeclimate-0.93.0 lib/cc/workspace/exclusion.rb
codeclimate-0.92.1 lib/cc/workspace/exclusion.rb
codeclimate-0.92.0 lib/cc/workspace/exclusion.rb
codeclimate-0.91.0 lib/cc/workspace/exclusion.rb
codeclimate-0.90.0 lib/cc/workspace/exclusion.rb
codeclimate-0.89.0 lib/cc/workspace/exclusion.rb
codeclimate-0.88.0 lib/cc/workspace/exclusion.rb
codeclimate-0.87.5 lib/cc/workspace/exclusion.rb
codeclimate-0.87.4 lib/cc/workspace/exclusion.rb
codeclimate-0.87.3 lib/cc/workspace/exclusion.rb
codeclimate-0.87.2 lib/cc/workspace/exclusion.rb
codeclimate-0.87.1 lib/cc/workspace/exclusion.rb
codeclimate-0.87.0 lib/cc/workspace/exclusion.rb
codeclimate-0.86.0 lib/cc/workspace/exclusion.rb
codeclimate-0.85.29 lib/cc/workspace/exclusion.rb
codeclimate-0.85.28 lib/cc/workspace/exclusion.rb