method
handle_method
v1_9_2_180 -
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 593
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 then
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
if File.exist? file_name then
body = (@@known_bodies[file_name] ||= File.read(file_name))
else
warn "unknown source #{source_file} for #{meth_name} in #{@file_name}"
end
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
meth_obj.visibility = :private if 'private_method' == type
end
end
end