Class: RDoc::PuppetClass
- Defined in:
- lib/puppet/util/rdoc/code_objects.rb
Overview
PuppetClass holds a puppet class It is mapped to a HTMLPuppetClass for display It leverages RDoc (ruby) Class
Direct Known Subclasses
Instance Attribute Summary collapse
-
#childs ⇒ Object
Returns the value of attribute childs.
-
#realizes ⇒ Object
Returns the value of attribute realizes.
-
#requires ⇒ Object
Returns the value of attribute requires.
-
#resource_list ⇒ Object
Returns the value of attribute resource_list.
Instance Method Summary collapse
- #add_child(child) ⇒ Object
- #add_realize(realized) ⇒ Object
-
#add_require(required) ⇒ Object
we’re (ab)using the RDoc require system here.
- #add_resource(resource) ⇒ Object
-
#find_symbol(symbol, method = nil) ⇒ Object
Look up the given symbol.
-
#initialize(name, superclass) ⇒ PuppetClass
constructor
A new instance of PuppetClass.
- #is_module? ⇒ Boolean
- #superclass=(superclass) ⇒ Object
Constructor Details
#initialize(name, superclass) ⇒ PuppetClass
Returns a new instance of PuppetClass.
93 94 95 96 97 98 99 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 93 def initialize(name, superclass) super(name,superclass) @resource_list = [] @requires = [] @realizes = [] @childs = [] end |
Instance Attribute Details
#childs ⇒ Object
Returns the value of attribute childs.
91 92 93 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 91 def childs @childs end |
#realizes ⇒ Object
Returns the value of attribute realizes.
91 92 93 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 91 def realizes @realizes end |
#requires ⇒ Object
Returns the value of attribute requires.
91 92 93 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 91 def requires @requires end |
#resource_list ⇒ Object
Returns the value of attribute resource_list.
91 92 93 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 91 def resource_list @resource_list end |
Instance Method Details
#add_child(child) ⇒ Object
124 125 126 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 124 def add_child(child) @childs << child end |
#add_realize(realized) ⇒ Object
120 121 122 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 120 def add_realize(realized) add_to(@realizes, realized) end |
#add_require(required) ⇒ Object
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.
116 117 118 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 116 def add_require(required) add_to(@requires, required) end |
#add_resource(resource) ⇒ Object
101 102 103 |
# 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) ⇒ Object
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.
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# 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? ⇒ Boolean
105 106 107 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 105 def is_module? false end |
#superclass=(superclass) ⇒ Object
109 110 111 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 109 def superclass=(superclass) @superclass = superclass end |