Class: Git::Lint::Validators::Capitalization

Inherits:
Object
  • Object
show all
Defined in:
lib/git/lint/validators/capitalization.rb

Constant Summary collapse

DEFAULT_PATTERN =
/\A[[:upper:]].*\Z/

Instance Method Summary collapse

Constructor Details

#initialize(text, delimiter: Name::DEFAULT_DELIMITER, pattern: DEFAULT_PATTERN) ⇒ Capitalization

Returns a new instance of Capitalization.



9
10
11
12
13
# File 'lib/git/lint/validators/capitalization.rb', line 9

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

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/git/lint/validators/capitalization.rb', line 15

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