method
handle_method
v1_8_6_287 -
Show latest stable
- Class:
RDoc::C_Parser
handle_method(type, var_name, meth_name, meth_body, param_count, source_file = nil)private
No documentation available.
# File lib/rdoc/parsers/parse_c.rb, line 579
def handle_method(type, var_name, meth_name,
meth_body, param_count, source_file = nil)
progress(".")
@stats.num_methods += 1
class_name = @known_classes[var_name]
return unless class_name
class_obj = find_class(var_name, class_name)
if class_obj
if meth_name == "initialize"
meth_name = "new"
type = "singleton_method"
end
meth_obj = AnyMethod.new("", meth_name)
meth_obj.singleton =
%w{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
file_name = File.join(@file_dir, source_file)
body = (@@known_bodies[source_file] ||= File.read(file_name))
else
body = @body
end
if find_body(meth_body, meth_obj, body) and meth_obj.document_self
class_obj.add_method(meth_obj)
end
end
end