Method: Puppet::Interface::ActionManager#get_action

Defined in:
lib/puppet/interface/action_manager.rb

#get_action(name) ⇒ Puppet::Interface::Action

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Retrieves a named action

Parameters:

  • name (Symbol)

    The name of the action

Returns:



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/puppet/interface/action_manager.rb', line 57

def get_action(name)
  @actions ||= {}
  result = @actions[name.to_sym]
  if result.nil?
    if is_a?(Class) and superclass.respond_to?(:get_action)
      found = superclass.get_action(name)
    elsif self.class.respond_to?(:get_action)
      found = self.class.get_action(name)
    end

    if found then
      # This is not the nicest way to make action equivalent to the Ruby
      # Method object, rather than UnboundMethod, but it will do for now,
      # and we only have to make this change in *one* place. --daniel 2011-04-12
      result = @actions[name.to_sym] = found.__dup_and_rebind_to(self)
    end
  end
  result
end