Sha256: c87d33ae7f4a1d88d93df847640768e1aca4ef57cb06032bc7230f78e2fc6751

Contents?: true

Size: 592 Bytes

Versions: 12

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

require "refinements/strings"

module Git
  module Lint
    module Validators
      # Validates the format of names.
      class Name
        using Refinements::Strings

        DELIMITER = /\s{1}/
        MINIMUM = 2

        def initialize delimiter: DELIMITER
          @delimiter = delimiter
        end

        def call content, minimum: MINIMUM
          parts = String(content).split delimiter
          parts.size >= minimum && parts.all? { |name| !name.blank? }
        end

        private

        attr_reader :delimiter
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
git-lint-6.2.1 lib/git/lint/validators/name.rb
git-lint-6.2.0 lib/git/lint/validators/name.rb
git-lint-6.1.0 lib/git/lint/validators/name.rb
git-lint-6.0.2 lib/git/lint/validators/name.rb
git-lint-6.0.1 lib/git/lint/validators/name.rb
git-lint-6.0.0 lib/git/lint/validators/name.rb
git-lint-5.3.0 lib/git/lint/validators/name.rb
git-lint-5.2.0 lib/git/lint/validators/name.rb
git-lint-5.1.2 lib/git/lint/validators/name.rb
git-lint-5.1.1 lib/git/lint/validators/name.rb
git-lint-5.1.0 lib/git/lint/validators/name.rb
git-lint-5.0.0 lib/git/lint/validators/name.rb