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)
Methods
- E
- M
- N
- R
Attributes
[R] | target |
Class Public methods
Take a default action target. Yield self if block given.
Source: show
# File rails/railties/lib/rails_generator/manifest.rb, line 19 def initialize(target = nil) @target, @actions = target, [] yield self if block_given? end
Instance Public methods
Erase recorded actions.
Source: show
# File rails/railties/lib/rails_generator/manifest.rb, line 40 def erase @actions = [] end
Record an action.
Source: show
# File rails/railties/lib/rails_generator/manifest.rb, line 25 def method_missing(action, *args, &block) @actions << [action, args, block] end
Replay recorded actions.
Source: show
# File rails/railties/lib/rails_generator/manifest.rb, line 30 def replay(target = nil) send_actions(target || @target, @actions) end
Rewind recorded actions.
Source: show
# File rails/railties/lib/rails_generator/manifest.rb, line 35 def rewind(target = nil) send_actions(target || @target, @actions.reverse) end