Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2_2_9) is shown here.
handle_method(type, var_name, meth_name, function, param_count, source_file = nil)
public
Adds an RDoc::AnyMethod
meth_name defined on a class or module assigned to
var_name. type is the type of method definition function
used. singleton_method and module_function create a
singleton method.
Show source
def handle_method(type, var_name, meth_name, function, param_count,
source_file = nil)
class_name = @known_classes[var_name]
singleton = @singleton_classes.key? var_name
@methods[var_name][function] << meth_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'
singleton = true
type = 'method'
end
meth_obj = RDoc::AnyMethod.new '', meth_name
meth_obj.c_function = function
meth_obj.singleton =
singleton || ]singleton_method module_function].include?(type)
p_count = Integer(param_count) rescue -1
if source_file then
file_name = File.join @file_dir, source_file
if File.exist? file_name then
file_content = File.read file_name
else
@options.warn "unknown source #{source_file} for #{meth_name} in #{@file_name}"
end
else
file_content = @content
end
body = find_body class_name, function, meth_obj, file_content
if body and meth_obj.document_self then
meth_obj.params = if p_count < -1 then
'(*args)'
elsif p_count == -1 then
rb_scan_args body
else
"(#{(1..p_count).map { |i| "p#{i}" }.join ', '})"
end
meth_obj.record_location @top_level
class_obj.add_method meth_obj
@stats.add_method meth_obj
meth_obj.visibility = :private if 'private_method' == type
end
end
end