Class: Dir

Inherits:
Object
  • Object
show all
Defined in:
lib/fif/utils.rb

Class Method Summary collapse

Class Method Details

.recurse(path, &block) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/fif/utils.rb', line 2

def self.recurse(path, &block)
  Dir.foreach(path) do |entry|
    next if (entry == '.' || entry == '..')

    full_path = File.join(path, entry)

    if File.directory?(full_path)
      recurse(full_path, &block)
    else
      yield full_path
    end
  end
end