Files

Class Index [+]

Quicksearch

Construct::PathExtensions

Attributes

construct__chdir_default[RW]

Public Instance Methods

chdir(&block) click to toggle source

Note: Pathname implements # directly, but it is deprecated in favor of Dir.chdir

    # File lib/construct/path_extensions.rb, line 43
43:     def chdir(&block)
44:       Dir.chdir(self, &block)
45:     end
destroy!() click to toggle source
    # File lib/construct/path_extensions.rb, line 47
47:     def destroy!
48:       rmtree
49:     end
directory(path,chdir=construct__chdir_default) click to toggle source
    # File lib/construct/path_extensions.rb, line 6
 6:     def directory(path,chdir=construct__chdir_default)
 7:       subdir = (self + path)
 8:       subdir.mkpath
 9:       subdir.extend(PathExtensions)
10:       subdir.maybe_change_dir(chdir) do
11:         yield(subdir) if block_given?
12:       end
13:       subdir
14:     end
file(filepath,contents=nil,&block) click to toggle source
    # File lib/construct/path_extensions.rb, line 16
16:     def file(filepath,contents=nil,&block)
17:       path = (self+filepath)
18:       path.dirname.mkpath
19:       File.open(path,'w') do |f|
20:         if(block)
21:           if(block.arity==1)
22:             block.call(f)
23:           else
24:             f << block.call
25:           end
26:         else
27:           f << contents
28:         end
29:       end
30:       path
31:     end
maybe_change_dir(chdir, &block) click to toggle source
    # File lib/construct/path_extensions.rb, line 33
33:     def maybe_change_dir(chdir, &block)
34:       if(chdir)
35:         self.chdir(&block)
36:       else
37:         block.call
38:       end
39:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.