Class: Forspell::FileList
- Inherits:
-
Object
- Object
- Forspell::FileList
- Includes:
- Enumerable
- Defined in:
- lib/forspell/file_list.rb
Defined Under Namespace
Classes: PathLoadError
Constant Summary collapse
- EXTENSION_GLOBS =
%w[ rb c cpp cxx md ].freeze
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(paths:, exclude_paths:) ⇒ FileList
constructor
A new instance of FileList.
Constructor Details
#initialize(paths:, exclude_paths:) ⇒ FileList
Returns a new instance of FileList.
16 17 18 19 |
# File 'lib/forspell/file_list.rb', line 16 def initialize(paths:, exclude_paths:) @paths = paths @exclude_paths = exclude_paths end |
Instance Method Details
#each(&block) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/forspell/file_list.rb', line 21 def each(&block) to_process = @paths.flat_map(&method(:expand_paths)) to_exclude = @exclude_paths.flat_map(&method(:expand_paths)) (to_process - to_exclude).map{ |path| path.gsub('//', '/')} .each(&block) end |