Class: SlimLint::FileFinder
- Inherits:
-
Object
- Object
- SlimLint::FileFinder
- Defined in:
- lib/slim_lint/file_finder.rb
Overview
Finds Slim files that should be linted given a specified list of paths, glob patterns, and configuration.
Constant Summary collapse
- VALID_EXTENSIONS =
List of extensions of files to include under a directory when a directory is specified instead of a file.
%w[.slim].freeze
Instance Method Summary collapse
-
#find(patterns, excluded_patterns) ⇒ Array<String>
Return list of files to lint given the specified set of paths and glob patterns.
-
#initialize(config) ⇒ FileFinder
constructor
Create a file finder using the specified configuration.
Constructor Details
#initialize(config) ⇒ FileFinder
Create a file finder using the specified configuration.
16 17 18 |
# File 'lib/slim_lint/file_finder.rb', line 16 def initialize(config) @config = config end |
Instance Method Details
#find(patterns, excluded_patterns) ⇒ Array<String>
Return list of files to lint given the specified set of paths and glob patterns.
26 27 28 29 30 31 32 |
# File 'lib/slim_lint/file_finder.rb', line 26 def find(patterns, excluded_patterns) excluded_patterns = excluded_patterns.map { |pattern| normalize_path(pattern) } extract_files_from(patterns).reject do |file| SlimLint::Utils.any_glob_matches?(excluded_patterns, file) end end |