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

Version Path
pakyow-core-0.8rc1 pakyow-core/lib/utils/dir.rb
pakyow-core-0.7.2 pakyow-core/lib/utils/dir.rb
pakyow-core-0.7.1 pakyow-core/lib/utils/dir.rb
pakyow-core-0.7.0 pakyow-core/lib/utils/dir.rb
pakyow-core-0.6.3.1 pakyow-core/lib/utils/dir.rb
pakyow-core-0.6.1 pakyow-core/lib/utils/dir.rb