Class: Reviewer::Tool::FileResolver
- Inherits:
-
Object
- Object
- Reviewer::Tool::FileResolver
- Defined in:
- lib/reviewer/tool/file_resolver.rb
Overview
Resolves which files a tool should process by mapping and filtering.
Instance Method Summary collapse
-
#initialize(settings) ⇒ FileResolver
constructor
Creates a FileResolver for a tool’s settings.
-
#resolve(files) ⇒ Array<String>
Resolves input files by mapping source files to test files (if configured) and filtering by the tool’s file pattern.
-
#skip?(files) ⇒ Boolean
Determines if the tool should be skipped because files were requested but none match.
Constructor Details
#initialize(settings) ⇒ FileResolver
Creates a FileResolver for a tool’s settings
11 12 13 |
# File 'lib/reviewer/tool/file_resolver.rb', line 11 def initialize(settings) @settings = settings end |
Instance Method Details
#resolve(files) ⇒ Array<String>
Resolves input files by mapping source files to test files (if configured) and filtering by the tool’s file pattern
20 21 22 23 24 |
# File 'lib/reviewer/tool/file_resolver.rb', line 20 def resolve(files) return files unless pattern filter(map(files)) end |
#skip?(files) ⇒ Boolean
Determines if the tool should be skipped because files were requested but none match
30 31 32 |
# File 'lib/reviewer/tool/file_resolver.rb', line 30 def skip?(files) files.any? && resolve(files).empty? end |