Class: Git::Lint::Validators::Name

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

Constant Summary collapse

DEFAULT_DELIMITER =
/\s{1}/
DEFAULT_MINIMUM =
2

Instance Method Summary collapse

Constructor Details

#initialize(text, delimiter: DEFAULT_DELIMITER, minimum: DEFAULT_MINIMUM) ⇒ Name

Returns a new instance of Name.



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

def initialize text, delimiter: DEFAULT_DELIMITER, minimum: DEFAULT_MINIMUM
  @text = text
  @delimiter = delimiter
  @minimum = minimum
end

Instance Method Details

#valid?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/git/lint/validators/name.rb', line 16

def valid?
  parts.size >= minimum && parts.all? { |name| !String(name).empty? }
end