Class: Dir
- Inherits:
-
Object
- Object
- Dir
- Defined in:
- lib/ruby/dir/mktree.rb
Class Method Summary collapse
-
.mktree(tree, base = Dir.pwd) ⇒ Object
create directory structure Dir.mktree( “a” => { “b” => [ “d”, “e” ], }, “in/directory” ).
Class Method Details
.mktree(tree, base = Dir.pwd) ⇒ Object
create directory structure Dir.mktree( “a” => { “b” => [ “d”, “e” ], }, “in/directory” )
20 21 22 23 24 25 26 27 |
# File 'lib/ruby/dir/mktree.rb', line 20 def mktree(tree, base=Dir.pwd) dir = []; tree.each { |dir, sub| current = "#{base}/#{dir}" mkdir(current) mktree(sub, current) if sub } end |