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