Sha256: 134a02e3c6b0adc6c82e58207c80d52ea0ca20524bbd1790eadf32c0c7babc4a
Contents?: true
Size: 538 Bytes
Versions: 6
Compression:
Stored size: 538 Bytes
Contents
module Pakyow # Utility methods for directories and files. class DirUtils # visit dir, then all files in dir, then walk_dir each directory in dir def self.walk_dir(dir, &block) yield dir all = Dir.entries(dir) partition = all.partition{|e| File.file?("#{dir}/#{e}")} files = partition[0] dirs = partition[1] files.each{|f| yield "#{dir}/#{f}" unless f.start_with?(".")} dirs.each{|d| walk_dir("#{dir}/#{d}", &block) unless d.start_with?(".")} end end end
Version data entries
6 entries across 6 versions & 1 rubygems