diff options
author | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-07 15:53:17 -0700 |
---|---|---|
committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-04-07 15:53:17 -0700 |
commit | a35fa519c85a761ac8bed3be8fde2d6523cae474 (patch) | |
tree | 36f3583ee364ba1d68467a2b614a8dfcf9ed43ae /lib/puppet/string/action_manager.rb | |
parent | 3d5ec4f61fee08552767e950ac021752c202a599 (diff) | |
parent | 87ed3188e65d3f5f9c2c32a409b271d1b39684b9 (diff) | |
download | puppet-a35fa519c85a761ac8bed3be8fde2d6523cae474.tar.gz puppet-a35fa519c85a761ac8bed3be8fde2d6523cae474.tar.xz puppet-a35fa519c85a761ac8bed3be8fde2d6523cae474.zip |
Merge branch 'refactor/master/7012-rename-strings-to-interfaces-and-faces'
Diffstat (limited to 'lib/puppet/string/action_manager.rb')
-rw-r--r-- | lib/puppet/string/action_manager.rb | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/lib/puppet/string/action_manager.rb b/lib/puppet/string/action_manager.rb deleted file mode 100644 index 9f0aa7582..000000000 --- a/lib/puppet/string/action_manager.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'puppet/string/action_builder' - -module Puppet::String::ActionManager - # Declare that this app can take a specific action, and provide - # the code to do so. - def action(name, &block) - @actions ||= {} - raise "Action #{name} already defined for #{self}" if action?(name) - action = Puppet::String::ActionBuilder.build(self, name, &block) - @actions[action.name] = action - end - - # This is the short-form of an action definition; it doesn't use the - # builder, just creates the action directly from the block. - def script(name, &block) - @actions ||= {} - raise "Action #{name} already defined for #{self}" if action?(name) - @actions[name] = Puppet::String::Action.new(self, name, :when_invoked => block) - end - - def actions - @actions ||= {} - result = @actions.keys - - if self.is_a?(Class) and superclass.respond_to?(:actions) - result += superclass.actions - elsif self.class.respond_to?(:actions) - result += self.class.actions - end - result.sort - end - - def get_action(name) - @actions ||= {} - result = @actions[name.to_sym] - if result.nil? - if self.is_a?(Class) and superclass.respond_to?(:get_action) - result = superclass.get_action(name) - elsif self.class.respond_to?(:get_action) - result = self.class.get_action(name) - end - end - return result - end - - def action?(name) - actions.include?(name.to_sym) - end -end |