method
handle_method
v1_9_1_378 -
Show latest stable
- Class:
RDoc::Parser::C
handle_method(type, var_name, meth_name, meth_body, param_count, source_file = nil)public
No documentation available.
# File lib/rdoc/parser/c.rb, line 564
def handle_method(type, var_name, meth_name, meth_body, param_count,
source_file = nil)
class_name = @known_classes[var_name]
return unless class_name
class_obj = find_class var_name, class_name
if class_obj then
if meth_name == "initialize" then
meth_name = "new"
type = "singleton_method"
end
meth_obj = RDoc::AnyMethod.new '', meth_name
meth_obj.singleton = ]singleton_method module_function].include? type
p_count = (Integer(param_count) rescue -1)
if p_count < 0
meth_obj.params = "(...)"
elsif p_count == 0
meth_obj.params = "()"
else
meth_obj.params = "(" + (1..p_count).map{|i| "p#{i}"}.join(", ") + ")"
end
if source_file then
file_name = File.join(@file_dir, source_file)
body = (@@known_bodies[source_file] ||= File.read(file_name))
else
body = @content
end
if find_body(class_name, meth_body, meth_obj, body) and meth_obj.document_self then
class_obj.add_method meth_obj
@stats.add_method meth_obj
end
end
end