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



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

def build_resource_detail_list(section)
  outer = []
  resources = @resources.sort
  resources.each do |r|
    row = {}
    next unless 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
  outer
end

#build_resource_summary_list(path_prefix = '') ⇒ Object



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

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



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

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