Class: Rufo::FileFinder
- Inherits:
-
Object
- Object
- Rufo::FileFinder
- Includes:
- Enumerable
- Defined in:
- lib/rufo/file_finder.rb
Constant Summary collapse
- RAKEFILES =
[ "**/rakefile", "**/Rakefile", "**/rakefile.rb", "**/Rakefile.rb", ]
- FILENAMES =
[ "**/Gemfile", *RAKEFILES, ]
- EXTENSIONS =
[ "**/*.rb", "**/*.gemspec", "**/*.rake", "**/*.ru", "**/*.jbuilder", "**/*.erb", ]
- DEFAULT_PATTERNS =
[ *FILENAMES, *EXTENSIONS, ]
- EXCLUDE_PATTERNS =
[ "vendor/**/*", "node_modules/**/*", ]
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(files_or_dirs, includes: [], excludes: []) ⇒ FileFinder
constructor
A new instance of FileFinder.
Constructor Details
#initialize(files_or_dirs, includes: [], excludes: []) ⇒ FileFinder
Returns a new instance of FileFinder.
36 37 38 39 40 |
# File 'lib/rufo/file_finder.rb', line 36 def initialize(files_or_dirs, includes: [], excludes: []) @files_or_dirs = files_or_dirs @includes = includes @excludes = excludes end |
Instance Method Details
#each ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/rufo/file_finder.rb', line 42 def each files_or_dirs.each do |file_or_dir| if Dir.exist?(file_or_dir) all_rb_files(file_or_dir).each { |file| yield [true, file] } else yield [File.exist?(file_or_dir), file_or_dir] end end end |