Sha256: ac99c33b23f76161b551ef46a929fc275239e95795bf9d78358ea2f1642f6a60

Contents?: true

Size: 602 Bytes

Versions: 16

Compression:

Stored size: 602 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    module Validators
      # Validates the capitalizationn of text.
      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

16 entries across 16 versions & 1 rubygems

Version Path
git-lint-4.6.0 lib/git/lint/validators/capitalization.rb
git-lint-4.5.0 lib/git/lint/validators/capitalization.rb
git-lint-4.4.0 lib/git/lint/validators/capitalization.rb
git-lint-4.3.0 lib/git/lint/validators/capitalization.rb
git-lint-4.2.0 lib/git/lint/validators/capitalization.rb
git-lint-4.1.0 lib/git/lint/validators/capitalization.rb
git-lint-4.0.1 lib/git/lint/validators/capitalization.rb
git-lint-4.0.0 lib/git/lint/validators/capitalization.rb
git-lint-3.3.2 lib/git/lint/validators/capitalization.rb
git-lint-3.3.1 lib/git/lint/validators/capitalization.rb
git-lint-3.3.0 lib/git/lint/validators/capitalization.rb
git-lint-3.2.0 lib/git/lint/validators/capitalization.rb
git-lint-3.1.0 lib/git/lint/validators/capitalization.rb
git-lint-3.0.2 lib/git/lint/validators/capitalization.rb
git-lint-3.0.1 lib/git/lint/validators/capitalization.rb
git-lint-3.0.0 lib/git/lint/validators/capitalization.rb