Class: Git::Lint::Validators::RepeatedWord
- Inherits:
-
Object
- Object
- Git::Lint::Validators::RepeatedWord
- Defined in:
- lib/git/lint/validators/repeated_word.rb
Overview
Validates content has no repeated words.
Constant Summary collapse
- PATTERNS =
{ word: / \w+(?=\s) # Match word with trailing space. | # Or. (?<=\s)\w+(?=\s) # Match word between two spaces. | # Or. (?<=\s)\w+ # Match word with leading space. /x, code_block: /`.+`/, version: /\d+\./ }.freeze
Instance Method Summary collapse
- #call(content) ⇒ Object
-
#initialize(patterns: PATTERNS) ⇒ RepeatedWord
constructor
A new instance of RepeatedWord.
Constructor Details
#initialize(patterns: PATTERNS) ⇒ RepeatedWord
Returns a new instance of RepeatedWord.
22 23 24 |
# File 'lib/git/lint/validators/repeated_word.rb', line 22 def initialize patterns: PATTERNS @patterns = patterns end |
Instance Method Details
#call(content) ⇒ Object
26 |
# File 'lib/git/lint/validators/repeated_word.rb', line 26 def call(content) = content ? scan(content) : Core::EMPTY_ARRAY |