Class: GhBbAudit::KeywordMatcher
- Inherits:
-
Object
- Object
- GhBbAudit::KeywordMatcher
- Defined in:
- lib/gh_bb_audit/keyword_matcher.rb
Instance Method Summary collapse
-
#initialize(keywords) ⇒ KeywordMatcher
constructor
A new instance of KeywordMatcher.
- #repo_contains_keyword?(repo_file_paths) ⇒ Boolean
Constructor Details
#initialize(keywords) ⇒ KeywordMatcher
Returns a new instance of KeywordMatcher.
4 5 6 |
# File 'lib/gh_bb_audit/keyword_matcher.rb', line 4 def initialize(keywords) @keyword_regex = Regexp.union(keywords) end |
Instance Method Details
#repo_contains_keyword?(repo_file_paths) ⇒ Boolean
8 9 10 |
# File 'lib/gh_bb_audit/keyword_matcher.rb', line 8 def repo_contains_keyword?(repo_file_paths) !((repo_file_paths.select { |files| @keyword_regex.match(files) }).empty?) end |