# class RDoc::PuppetClass

PuppetClass holds a puppet class It is mapped to a HTMLPuppetClass for display It leverages RDoc (ruby) Class

### Attributes

childs[RW]
realizes[RW]
requires[RW]
resource_list[RW]

### Public Class Methods

new(name, superclass) click to toggle source
Calls superclass method

    # File lib/puppet/util/rdoc/code_objects.rb, line 93
    def initialize(name, superclass)
      super(name,superclass)
      @resource_list = []
      @requires = []
      @realizes = []
      @childs = []
    end

### Public Instance Methods

add_child(child) click to toggle source

    # File lib/puppet/util/rdoc/code_objects.rb, line 124
    def add_child(child)
      @childs << child
    end

add_realize(realized) click to toggle source

    # File lib/puppet/util/rdoc/code_objects.rb, line 120
    def add_realize(realized)
      add_to(@realizes, realized)
    end

add_require(required) click to toggle source

we’re (ab)using the RDoc require system here. we’re adding a required Puppet class, overriding the RDoc #add_require method which sees ruby required files.

    # File lib/puppet/util/rdoc/code_objects.rb, line 116
    def add_require(required)
      add_to(@requires, required)
    end

add_resource(resource) click to toggle source

    # File lib/puppet/util/rdoc/code_objects.rb, line 101
    def add_resource(resource)
      add_to(@resource_list, resource)
    end

find_symbol(symbol, method=nil) click to toggle source

Look up the given symbol. RDoc only looks for class1::class2.method or class1::class2#method. Since our definitions are mapped to RDoc methods but are written class1::class2::define we need to perform the lookup by ourselves.

Calls superclass method

    # File lib/puppet/util/rdoc/code_objects.rb, line 132
    def find_symbol(symbol, method=nil)
      result = super
      if not result and symbol =~ /::/
        modules = symbol.split(/::/)
        unless modules.empty?
          module_name = modules.shift
          result = find_module_named(module_name)
          if result
            last_name = ""
            previous = nil
            modules.each do |module_name|
              previous = result
              last_name = module_name
              result = result.find_module_named(module_name)
              break unless result
            end
            unless result
              result = previous
              method = last_name
            end
          end
        end
        if result && method
          if !result.respond_to?(:find_local_symbol)
            p result.name
            p method
            fail
          end
          result = result.find_local_symbol(method)
        end
      end
      result
    end

is_module?() click to toggle source

    # File lib/puppet/util/rdoc/code_objects.rb, line 105
    def is_module?
      false
    end

superclass=(superclass) click to toggle source

    # File lib/puppet/util/rdoc/code_objects.rb, line 109
    def superclass=(superclass)
      @superclass = superclass
    end