Sha256: 4205c5c5ca3b3048621958565c3c429fcece389dbdb6794bacdedd036291dfb5

Contents?: true

Size: 555 Bytes

Versions: 5

Compression:

Stored size: 555 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Validators
      class Capitalization
        DEFAULT_PATTERN = /\A[[:upper:]].*\Z/

        def initialize text, delimiter: Name::DEFAULT_DELIMITER, pattern: DEFAULT_PATTERN
          @text = String text
          @delimiter = delimiter
          @pattern = pattern
        end

        def valid? = parts.all? { |name| String(name).match? pattern }

        private

        attr_reader :text, :delimiter, :pattern

        def parts = text.split(delimiter)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
git-lint-2.4.0 lib/git/lint/validators/capitalization.rb
git-lint-2.3.3 lib/git/lint/validators/capitalization.rb
git-lint-2.3.2 lib/git/lint/validators/capitalization.rb
git-lint-2.3.1 lib/git/lint/validators/capitalization.rb
git-lint-2.3.0 lib/git/lint/validators/capitalization.rb