Module: MyRecursiveSearch

Defined in:
lib/my_recursive_search.rb,
lib/my_recursive_search/version.rb

Overview

lib/my_recursive_search.rb

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.recursive_search(directory, file_name) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/my_recursive_search.rb', line 6

def self.recursive_search(directory, file_name)
  found_files = []

  # Проходимо через всі файли та підкаталоги
  Dir.glob(File.join(directory, '**', '*')).each do |file_path|
    if File.file?(file_path) && File.basename(file_path) == file_name
      found_files << file_path
    end
  end

  found_files
end