Parent

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
18:     def initialize(target = nil)
19:       @target, @actions = target, []
20:       yield self if block_given?
21:     end

Public Instance Methods

erase() click to toggle source

Erase recorded actions.

    # File lib/rubigen/manifest.rb, line 39
39:     def erase
40:       @actions = []
41:     end
method_missing(action, *args, &block) click to toggle source

Record an action.

    # File lib/rubigen/manifest.rb, line 24
24:     def method_missing(action, *args, &block)
25:       @actions << [action, args, block]
26:     end
replay(target = nil) click to toggle source

Replay recorded actions.

    # File lib/rubigen/manifest.rb, line 29
29:     def replay(target = nil)
30:       send_actions(target || @target, @actions)
31:     end
rewind(target = nil) click to toggle source

Rewind recorded actions.

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

Private Instance Methods

send_actions(target, actions) click to toggle source
    # File lib/rubigen/manifest.rb, line 44
44:       def send_actions(target, actions)
45:         actions.each do |method, args, block|
46:           target.send(method, *args, &block)
47:         end
48:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.