Class: Filemerger::Searcher

Inherits:
Object
  • Object
show all
Defined in:
lib/filemerger/searcher.rb

Class Method Summary collapse

Class Method Details

.find_files_for_mask(mask, folders) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/filemerger/searcher.rb', line 5

def self.find_files_for_mask(mask, folders)
  unless folders.nil? || folders.empty?
    files_for_merge = []
    folders.each do |folder|
      Poster.post_search_files("#{folder}/*#{mask}")
      files_for_mask = Dir.glob("#{folder}/*#{mask}")
      files_for_merge += files_for_mask
    end
    return files_for_merge
  else
    Poster.post_default_searching_path
    files = Dir.glob("**/*#{mask}")
    return files
  end
end