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-fede-0.85.38 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.37 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.36 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.35 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.33 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.32 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.31 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.30 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.21 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.24 lib/cc/workspace/exclusion.rb
codeclimate-fede-0.85.23 lib/cc/workspace/exclusion.rb
codeclimate-0.85.23 lib/cc/workspace/exclusion.rb
codeclimate-0.85.22 lib/cc/workspace/exclusion.rb
codeclimate-0.85.21 lib/cc/workspace/exclusion.rb
codeclimate-0.85.19 lib/cc/workspace/exclusion.rb
codeclimate-0.85.18 lib/cc/workspace/exclusion.rb
codeclimate-0.85.17 lib/cc/workspace/exclusion.rb
codeclimate-0.85.15 lib/cc/workspace/exclusion.rb
codeclimate-0.85.14 lib/cc/workspace/exclusion.rb
codeclimate-0.85.13 lib/cc/workspace/exclusion.rb