Method: Transpec::FileFinder.find

Defined in:
lib/transpec/file_finder.rb

.find(paths) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/transpec/file_finder.rb', line 9

def find(paths)
  base_paths(paths).reduce([]) do |file_paths, path|
    if File.directory?(path)
      file_paths.concat(ruby_files_in_directory(path))
    elsif File.file?(path)
      file_paths << path
    elsif !File.exists?(path)
      fail ArgumentError, "No such file or directory #{path.inspect}"
    end
  end
end