Class: Templater::Actions::EmptyDirectory

### Home Classes Methods

### In Files

- lib/templater/actions/empty_directory.rb

### Parent

Templater::Actions::Action

### Methods

- ::new
- #exists?
- #identical?
- #invoke!
- #render
- #revoke!

### Files

- History.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Templater
- Templater::ActionDescription
- Templater::Actions
- Templater::Actions::Action
- Templater::Actions::Directory
- Templater::Actions::EmptyDirectory
- Templater::Actions::File
- Templater::Actions::Template
- Templater::ArgumentDescription
- Templater::CLI
- Templater::CLI::Generator
- Templater::CLI::Manifold
- Templater::Description
- Templater::Discovery
- Templater::Generator
- Templater::InvocationDescription
- Templater::Manifold
- Templater::Spec
- Templater::Spec::Helpers
- Templater::Spec::Helpers::CreateMatcher
- Templater::Spec::Helpers::InvokeMatcher
- Kernel
- String

No matching classes.

# Templater::Actions::EmptyDirectory

### Public Class Methods

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

Builds a new Directory

### Parameters

generator<Object> | The generator
name<Symbol> | The name of this directory
destination<String> | Full path to the destination of this directory
options<Hash{Symbol=>Symbol} | Options, including callbacks.

    # File lib/templater/actions/empty_directory.rb, line 12
    def initialize(generator, name, destination, options={})
      self.generator = generator
      self.name = name
      self.destination = destination
      self.options = options
    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
    def exists?
      ::File.exists?(destination)
    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
    def identical?
      exists?
    end

invoke!() click to toggle source

Renders the template and copies it to the destination.

    # File lib/templater/actions/empty_directory.rb, line 44
    def invoke!
      callback(:before)
      ::FileUtils.mkdir_p(destination)
      callback(:after)
    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
    def render
      ''
    end

revoke!() click to toggle source

removes the destination file

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

[Validate]

Generated with the Darkfish Rdoc Generator 2.