Method: Puppet::Interface::ActionManager#action
- Defined in:
- lib/vendor/puppet/interface/action_manager.rb
#action(name, &block) ⇒ Object
Declare that this app can take a specific action, and provide the code to do so.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/vendor/puppet/interface/action_manager.rb', line 7 def action(name, &block) @actions ||= {} raise "Action #{name} already defined for #{self}" if action?(name) action = Puppet::Interface::ActionBuilder.build(self, name, &block) if action.default and current = get_default_action raise "Actions #{current.name} and #{name} cannot both be default" end @actions[action.name] = action end |