Class: TodoLint::FileFinder
- Inherits:
-
Object
- Object
- TodoLint::FileFinder
- Defined in:
- lib/todo_lint/file_finder.rb
Overview
Which files are we going to inspect?
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Options hash for all configurations.
Instance Method Summary collapse
-
#initialize(path, options) ⇒ FileFinder
constructor
Instantiate a FileFinder with the path to a folder.
-
#list(*extensions) ⇒ Array<String>
Absolute paths to all the files with the provided extensions.
Constructor Details
#initialize(path, options) ⇒ FileFinder
Instantiate a FileFinder with the path to a folder
10 11 12 13 14 15 |
# File 'lib/todo_lint/file_finder.rb', line 10 def initialize(path, ) @path = path @options = @all_files = Dir.glob(Pathname.new(path).join("**", "*")) @excluded = [:excluded_files] end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Options hash for all configurations
34 35 36 |
# File 'lib/todo_lint/file_finder.rb', line 34 def @options end |
Instance Method Details
#list(*extensions) ⇒ Array<String>
Absolute paths to all the files with the provided extensions
22 23 24 25 26 27 28 |
# File 'lib/todo_lint/file_finder.rb', line 22 def list(*extensions) all_files.keep_if do |filename| extensions.include?(Pathname.new(filename).extname) end all_files.reject! { |file| excluded_file?(file) } all_files end |