Templater::Manifold

Public Instance Methods

add(name, generator) click to toggle source
Alias for: add_public
add_private(name, generator) click to toggle source

Add a generator for internal use to this manifold.

Parameters

name

The name given to this generator in the manifold

generator

The generator class

    # File lib/templater/manifold.rb, line 47
47:     def add_private(name, generator)
48:       private_generators[name.to_sym] = generator
49:       generator.manifold = self
50:     end
add_public(name, generator) click to toggle source

Add a generator to this manifold

Parameters

name

The name given to this generator in the manifold

generator

The generator class

    # File lib/templater/manifold.rb, line 35
35:     def add_public(name, generator)
36:       public_generators[name.to_sym] = generator
37:       generator.manifold = self
38:     end
Also aliased as: add
desc(text = nil) click to toggle source

If the argument is omitted, simply returns the description for this manifold, otherwise sets the description to the passed string.

Parameters

text

A description

Returns

String

The description for this manifold

    # File lib/templater/manifold.rb, line 91
91:     def desc(text = nil)
92:       @text = text if text
93:       return @text.realign_indentation
94:     end
generator(name) click to toggle source

Finds the class of a generator, given its name in the manifold.

Parameters

name

The name of the generator to find

Returns

Templater::Generator

The found generator class

    # File lib/templater/manifold.rb, line 68
68:     def generator(name)
69:       generators[name.to_sym]
70:     end
generators() click to toggle source

Lists all generators in this manifold

Returns

Array[Templater::Generator]

A list of generators

    # File lib/templater/manifold.rb, line 9
 9:     def generators
10:       private_generators.merge(public_generators)
11:     end
private_generators() click to toggle source

Lists all private generators, these are generators that are meant to be used only internally and should not be invoked directly (although the interface may choose to do so)

Returns

Array[Templater::Generator]

A list of generators

    # File lib/templater/manifold.rb, line 26
26:     def private_generators
27:       @private_generators ||= {} 
28:     end
public_generators() click to toggle source

Lists all public generators, these are generators that are meant to be invoked directly by the user.

Returns

Array[Templater::Generator]

A list of generators

    # File lib/templater/manifold.rb, line 17
17:     def public_generators
18:       @public_generators ||= {} 
19:     end
remove(name) click to toggle source

Remove the generator with the given name from the manifold

Parameters

name

The name of the generator to be removed.

    # File lib/templater/manifold.rb, line 56
56:     def remove(name)
57:       public_generators.delete(name.to_sym)
58:       private_generators.delete(name.to_sym)
59:     end
run_cli(destination_root, name, version, args) click to toggle source

A Shortcut method for invoking the command line interface provided with Templater.

Parameters

destination_root

Where the generated files should be put, this would usually be Dir.pwd

name

The name of the executable running this generator (such as ‘merb-gen’)

version

The version number of the executable.

args

An array of arguments to pass into the generator. This would usually be ARGV

    # File lib/templater/manifold.rb, line 79
79:     def run_cli(destination_root, name, version, args)
80:       Templater::CLI::Manifold.run(destination_root, self, name, version, args)
81:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.