Class: Dir

Inherits:
Object show all
Defined in:
src/util/dir.rb,
ext/fipdf/test/suite.rb

Overview

!/usr/bin/env ruby TestSuite — fipdf — 19.02.2004 — hwyss@ywesee.com

Class Method Summary (collapse)

Class Method Details

+ (Object) mkdir_r(name)



5
6
7
8
9
10
11
# File 'src/util/dir.rb', line 5

def Dir.mkdir_r(name)
  parent = File.dirname(name)
  unless(File.exist?(parent))
    self.mkdir_r(parent)
  end
  mkdir(name)
end

+ (Object) recursive(dirpath, parent = dirpath, &block)



5
6
7
8
9
10
11
12
13
14
# File 'ext/fipdf/test/suite.rb', line 5

def Dir.recursive(dirpath, parent=dirpath, &block)
  foreach(dirpath) { |item|
    path = File.expand_path(item, parent)
    if(!/^\.{1,2}$/.match(item) && File.ftype(path) == 'directory')
      recursive(File.expand_path(item, dirpath), path, &block)
    else
      block.call(path)
    end
  }
end