Class: Git::Lint::Validators::Name
- Inherits:
-
Object
- Object
- Git::Lint::Validators::Name
- Defined in:
- lib/git/lint/validators/name.rb
Constant Summary collapse
- DEFAULT_DELIMITER =
/\s{1}/
- DEFAULT_MINIMUM =
2
Instance Method Summary collapse
-
#initialize(text, delimiter: DEFAULT_DELIMITER, minimum: DEFAULT_MINIMUM) ⇒ Name
constructor
A new instance of Name.
- #valid? ⇒ Boolean
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
16 17 18 |
# File 'lib/git/lint/validators/name.rb', line 16 def valid? parts.size >= minimum && parts.all? { |name| !String(name).empty? } end |