Class: RubiGen::Manifest

### Home Classes Methods

### In Files

- lib/rubigen/manifest.rb

### Parent

Object

### Methods

- ::new
- #erase
- #method_missing
- #replay
- #rewind

### Files

- History.txt
- License.txt
- Manifest.txt
- Todo.txt
- README.txt
- index.txt
- version-raw.txt
- version.txt

### Class/Module Index

Quicksearch

- RubiGen
- RubiGen::AbstractGemSource
- RubiGen::Base
- RubiGen::Commands
- RubiGen::Commands::Base
- RubiGen::Commands::Create
- RubiGen::Commands::Destroy
- RubiGen::Commands::List
- RubiGen::Commands::RewindBase
- RubiGen::Commands::Update
- RubiGen::GemPathSource
- RubiGen::GeneratedAttribute
- RubiGen::GeneratorError
- RubiGen::GeneratorTestHelper
- RubiGen::Lookup
- RubiGen::Lookup::ClassMethods
- RubiGen::Manifest
- RubiGen::Options
- RubiGen::Options::ClassMethods
- RubiGen::PathFilteredSource
- RubiGen::PathSource
- RubiGen::Scripts
- RubiGen::Scripts::Base
- RubiGen::Scripts::Destroy
- RubiGen::Scripts::Generate
- RubiGen::Scripts::Update
- RubiGen::Source
- RubiGen::Spec
- RubiGen::UsageError
- Rubigen
- Rubigen::CLI
- Dir
- Object

No matching classes.

# RubiGen::Manifest

Manifest captures the actions a generator performs. Instantiate a manifest with an optional target object, hammer it with actions, then replay or rewind on the object of your choice.

Example:

    manifest = Manifest.new { |m|
      m.make_directory '/foo'
      m.create_file '/foo/bar.txt'
    }
    manifest.replay(creator)
    manifest.rewind(destroyer)

### Attributes

target[R]

### Public Class Methods

new(target = nil) click to toggle source

Take a default action target. Yield self if block given.

    # File lib/rubigen/manifest.rb, line 18
    def initialize(target = nil)
      @target, @actions = target, []
      yield self if block_given?
    end

### Public Instance Methods

erase() click to toggle source

Erase recorded actions.

    # File lib/rubigen/manifest.rb, line 39
    def erase
      @actions = []
    end

method_missing(action, *args, &block) click to toggle source

Record an action.

    # File lib/rubigen/manifest.rb, line 24
    def method_missing(action, *args, &block)
      @actions << [action, args, block]
    end

replay(target = nil) click to toggle source

Replay recorded actions.

    # File lib/rubigen/manifest.rb, line 29
    def replay(target = nil)
      send_actions(target || @target, @actions)
    end

rewind(target = nil) click to toggle source

Rewind recorded actions.

    # File lib/rubigen/manifest.rb, line 34
    def rewind(target = nil)
      send_actions(target || @target, @actions.reverse)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.