Even more convenient access to commands. Include Commands in the generator Base class to get a nice # instance method which returns a delegate for the requested command.
# File lib/rubigen/commands.rb, line 19 19: def self.included(base) 20: base.send(:define_method, :command) do |command| 21: Commands.instance(command, self) 22: end 23: end
Here’s a convenient way to get a handle on generator commands. Command.instance(‘destroy’, my_generator) instantiates a Destroy delegate of my_generator ready to do your dirty work.
# File lib/rubigen/commands.rb, line 12 12: def self.instance(command, generator) 13: const_get(command.to_s.camelize).new(generator) 14: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.