Class: RubyCrystalCodemod::FileFinder

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ruby_crystal_codemod/file_finder.rb

Constant Summary collapse

EXTENSIONS =

FILENAMES = [

"Gemfile",
*RAKEFILES,

]

[
  ".rb",
# ".gemspec",
# ".rake",
# ".jbuilder",
]
EXCLUDED_DIRS =
[
  "vendor",
]

Instance Method Summary collapse

Constructor Details

#initialize(files_or_dirs) ⇒ FileFinder

Returns a new instance of FileFinder.



30
31
32
# File 'lib/ruby_crystal_codemod/file_finder.rb', line 30

def initialize(files_or_dirs)
  @files_or_dirs = files_or_dirs
end

Instance Method Details

#eachObject



34
35
36
37
38
39
40
41
42
# File 'lib/ruby_crystal_codemod/file_finder.rb', line 34

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