Class: RDoc::PuppetClass
- Includes:
- AddClassModuleComment
- 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
- #aref_prefix ⇒ 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
Methods included from AddClassModuleComment
Constructor Details
#initialize(name, superclass) ⇒ PuppetClass
Returns a new instance of PuppetClass.
141 142 143 144 145 146 147 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 141 def initialize(name, superclass) super(name,superclass) @resource_list = [] @requires = [] @realizes = [] @childs = [] end |
Instance Attribute Details
#childs ⇒ Object
Returns the value of attribute childs.
139 140 141 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 139 def childs @childs end |
#realizes ⇒ Object
Returns the value of attribute realizes.
139 140 141 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 139 def realizes @realizes end |
#requires ⇒ Object
Returns the value of attribute requires.
139 140 141 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 139 def requires @requires end |
#resource_list ⇒ Object
Returns the value of attribute resource_list.
139 140 141 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 139 def resource_list @resource_list end |
Instance Method Details
#add_child(child) ⇒ Object
176 177 178 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 176 def add_child(child) @childs << child end |
#add_realize(realized) ⇒ Object
172 173 174 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 172 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.
168 169 170 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 168 def add_require(required) add_to(@requires, required) end |
#add_resource(resource) ⇒ Object
153 154 155 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 153 def add_resource(resource) add_to(@resource_list, resource) end |
#aref_prefix ⇒ Object
149 150 151 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 149 def aref_prefix 'puppet_class' 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.
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 184 def find_symbol(symbol, method=nil) result = super(symbol) 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
157 158 159 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 157 def is_module? false end |
#superclass=(superclass) ⇒ Object
161 162 163 |
# File 'lib/puppet/util/rdoc/code_objects.rb', line 161 def superclass=(superclass) @superclass = superclass end |