Method: Puppet::Interface::ActionManager#get_action

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

#get_action(name) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/vendor/puppet/interface/action_manager.rb', line 43

def get_action(name)
  @actions ||= {}
  result = @actions[name.to_sym]
  if result.nil?
    if self.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
  return result
end