Templater::Actions::EmptyDirectory

Public Class Methods

new(generator, name, destination, options={}) click to toggle source

Builds a new Directory

Parameters

generator

The generator

name

The name of this directory

destination

Full path to the destination of this directory

optionsSymbol}

Options, including callbacks.

    # File lib/templater/actions/empty_directory.rb, line 12
12:       def initialize(generator, name, destination, options={})
13:         self.generator = generator
14:         self.name = name
15:         self.destination = destination
16:         self.options = options
17:       end

Public Instance Methods

exists?() click to toggle source

Checks if the destination file already exists.

Returns

Boolean

true if the file exists, false otherwise.

    # File lib/templater/actions/empty_directory.rb, line 31
31:       def exists?
32:         ::File.exists?(destination)
33:       end
identical?() click to toggle source

For empty directory this is in fact alias for exists? method.

Returns

Boolean

true if it is identical, false otherwise.

    # File lib/templater/actions/empty_directory.rb, line 39
39:       def identical?
40:         exists?
41:       end
invoke!() click to toggle source

Renders the template and copies it to the destination.

    # File lib/templater/actions/empty_directory.rb, line 44
44:       def invoke!
45:         callback(:before)
46:         ::FileUtils.mkdir_p(destination)
47:         callback(:after)
48:       end
render() click to toggle source

Returns an empty String: there’s nothing to read from.

Returns

String

The source file.

    # File lib/templater/actions/empty_directory.rb, line 23
23:       def render
24:         ''
25:       end
revoke!() click to toggle source

removes the destination file

    # File lib/templater/actions/empty_directory.rb, line 51
51:       def revoke!
52:         ::FileUtils.rm_rf(::File.expand_path(destination))
53:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.