Sha256: 677ae8ecd433fcf7756f0f4f4ffb29c650d63d2dc8d1a787abe44b78f4880dd0

Contents?: true

Size: 590 Bytes

Versions: 14

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

require "refinements/string"

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

        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

14 entries across 14 versions & 1 rubygems

Version Path
git-lint-8.8.0 lib/git/lint/validators/name.rb
git-lint-8.7.0 lib/git/lint/validators/name.rb
git-lint-8.6.0 lib/git/lint/validators/name.rb
git-lint-8.5.0 lib/git/lint/validators/name.rb
git-lint-8.4.0 lib/git/lint/validators/name.rb
git-lint-8.3.0 lib/git/lint/validators/name.rb
git-lint-8.2.0 lib/git/lint/validators/name.rb
git-lint-8.1.0 lib/git/lint/validators/name.rb
git-lint-8.0.0 lib/git/lint/validators/name.rb
git-lint-7.5.0 lib/git/lint/validators/name.rb
git-lint-7.3.0 lib/git/lint/validators/name.rb
git-lint-7.2.0 lib/git/lint/validators/name.rb
git-lint-7.1.0 lib/git/lint/validators/name.rb
git-lint-7.0.0 lib/git/lint/validators/name.rb