Class: RDoc::PuppetModule
- Includes:
- AddClassModuleComment
- Defined in:
- lib/puppet/util/rdoc/code_objects.rb
Overview
PuppetModule holds a Puppet Module This is mapped to an HTMLPuppetModule it leverage the RDoc (ruby) module infrastructure
Instance Attribute Summary collapse
-
#facts ⇒ Object
Returns the value of attribute facts.
-
#plugins ⇒ Object
Returns the value of attribute plugins.
Instance Method Summary collapse
- #add_fact(fact) ⇒ Object
-
#add_node(name, superclass) ⇒ Object
Adds a module called __nodes__ and adds nodes to it as classes.
- #add_plugin(plugin) ⇒ Object
- #each_fact ⇒ Object
- #each_node ⇒ Object
- #each_plugin ⇒ Object
-
#initialize(name, superclass = nil) ⇒ PuppetModule
constructor
A new instance of PuppetModule.
- #nodes ⇒ Object
Methods included from AddClassModuleComment
Constructor Details
#initialize(name, superclass = nil) ⇒ PuppetModule
Returns a new instance of PuppetModule.
33 34 35 36 37 38 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 33 def initialize(name,superclass=nil) @facts = [] @plugins = [] @nodes = {} super(name,superclass) end |
Instance Attribute Details
#facts ⇒ Object
Returns the value of attribute facts.
31 32 33 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 31 def facts @facts end |
#plugins ⇒ Object
Returns the value of attribute plugins.
31 32 33 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 31 def plugins @plugins end |
Instance Method Details
#add_fact(fact) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 58 def add_fact(fact) @fact_container ||= add_module(NormalModule, "__facts__") confine_str = fact.confine.empty? ? '' : fact.confine.to_s const = Constant.new(fact.name, confine_str, fact.comment) @fact_container.add_constant(const) end |
#add_node(name, superclass) ⇒ Object
Adds a module called __nodes__ and adds nodes to it as classes
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 67 def add_node(name,superclass) cls = @nodes[name] if cls return cls end @node_container ||= add_module(NormalModule, "__nodes__") cls = @node_container.add_class(PuppetNode, name, superclass) @nodes[name] = cls if !@done_documenting cls end |
#add_plugin(plugin) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 40 def add_plugin(plugin) name = plugin.name type = plugin.type meth = AnyMethod.new("*args", name) meth.params = "(*args)" meth.visibility = :public meth.document_self = true meth.singleton = false meth.comment = plugin.comment if type == 'function' @function_container ||= add_module(NormalModule, "__functions__") @function_container.add_method(meth) elsif type == 'type' @type_container ||= add_module(NormalModule, "__types__") @type_container.add_method(meth) end end |
#each_fact ⇒ Object
78 79 80 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 78 def each_fact @facts.each {|c| yield c} end |
#each_node ⇒ Object
86 87 88 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 86 def each_node @nodes.each {|c| yield c} end |
#each_plugin ⇒ Object
82 83 84 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 82 def each_plugin @plugins.each {|c| yield c} end |
#nodes ⇒ Object
90 91 92 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 90 def nodes @nodes.values end |