Class: DirTraverser
- Inherits:
-
Object
- Object
- DirTraverser
- Defined in:
- lib/simple-make/dir_traverser.rb
Class Method Summary collapse
Class Method Details
.all_files_in_path(base, found = []) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/simple-make/dir_traverser.rb', line 2 def self.all_files_in_path base, found=[] return [] if !File.exist? base Dir.foreach(base) do |each| next if(each == "." || each == "..") full_name = base + "/" +each if File.directory? full_name all_files_in_path(full_name, found) else found << full_name end end found end |
.all_folders_in_path(base, found = []) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/simple-make/dir_traverser.rb', line 17 def self.all_folders_in_path base, found=[] return [] if !File.exist? base Dir.foreach(base) do |each| next if(each == "." || each == "..") full_name = base + "/" +each if File.directory? full_name found << full_name all_folders_in_path(full_name, found) end end found end |