Module: Generators::ResourceContainer

Included in:
HTMLPuppetClass, HTMLPuppetNode
Defined in:
lib/puppet/util/rdoc/generators/puppet_generator.rb

Overview

This module is used to hold/generate a list of puppet resources this is used in HTMLPuppetClass and HTMLPuppetNode

Instance Method Summary collapse

Instance Method Details

#build_resource_detail_list(section) ⇒ Object


394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 394

def build_resource_detail_list(section)
  outer = []
  resources = @resources.sort
  resources.each do |r|
    row = {}
    if r.section == section and r.document_self
      row["name"]        = CGI.escapeHTML(r.name)
      desc = r.description.strip
      row["m_desc"]      = desc unless desc.empty?
      row["aref"]        = r.aref
      row["params"]      = r.params
      outer << row
    end
  end
  outer
end

#build_resource_summary_list(path_prefix = '') ⇒ Object


381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 381

def build_resource_summary_list(path_prefix='')
  collect_resources unless @resources
  resources = @resources.sort
  res = []
  resources.each do |r|
    res << {
      "name" => CGI.escapeHTML(r.name),
      "aref" => Puppet::Util.uri_encode(path_prefix)+"\#"+Puppet::Util.uri_query_encode(r.aref)
    }
  end
  res
end

#collect_resourcesObject


376
377
378
379
# File 'lib/puppet/util/rdoc/generators/puppet_generator.rb', line 376

def collect_resources
  list = @context.resource_list
  @resources = list.collect {|m| HTMLPuppetResource.new(m, self, @options) }
end