# File lib/puppet/util/rdoc/parser.rb, line 295
295:   def document_define(name, define, container)
296:     Puppet.debug "rdoc: found new definition #{name}"
297:     # find superclas if any
298:     @stats.num_methods += 1
299: 
300:     # find the parent
301:     # split define name by :: to find the complete module hierarchy
302:     container, name = get_class_or_module(container,name)
303: 
304:     # build up declaration
305:     declaration = ""
306:     define.arguments.each do |arg,value|
307:       declaration << "\$#{arg}"
308:       unless value.nil?
309:         declaration << " => "
310:         case value
311:         when Puppet::Parser::AST::Leaf
312:           declaration << "'#{value.value}'"
313:         when Puppet::Parser::AST::ASTArray
314:           declaration << "[#{value.children.collect { |v| "'#{v}'" }.join(", ")}]"
315:         else
316:           declaration << "#{value.to_s}"
317:         end
318:       end
319:       declaration << ", "
320:     end
321:     declaration.chop!.chop! if declaration.size > 1
322: 
323:     # register method into the container
324:     meth =  AnyMethod.new(declaration, name)
325:     meth.comment = define.doc
326:     container.add_method(meth)
327:     look_for_directives_in(container, meth.comment) unless meth.comment.empty?
328:     meth.params = "( #{declaration} )"
329:     meth.visibility = :public
330:     meth.document_self = true
331:     meth.singleton = false
332:   rescue => detail
333:     raise Puppet::ParseError, "impossible to parse definition '#{name}' in #{define.file} at line #{define.line}: #{detail}"
334:   end