class 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
identical?()
click to toggle source
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
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