class Rufo::FileFinder
def all_rb_files(file_or_dir)
def all_rb_files(file_or_dir) files = [] Find.find(file_or_dir) do |path| basename = File.basename(path) if File.directory?(path) Find.prune if EXCLUDED_DIRS.include?(basename) else if EXTENSIONS.include?(File.extname(basename)) || FILENAMES.include?(basename) files << path end end end files end
def each
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
def initialize(files_or_dirs)
def initialize(files_or_dirs) @files_or_dirs = files_or_dirs end