Method: RDoc::Parser::C#handle_method
- Defined in:
- lib/rdoc/parser/c.rb
#handle_method(type, var_name, meth_name, function, param_count, source_file = nil) ⇒ Object
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.
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/rdoc/parser/c.rb', line 996 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 existing_method = class_obj.method_list.find { |m| m.c_function == function } add_alias(var_name, class_obj, existing_method.name, meth_name, existing_method.comment) end if class_obj then if meth_name == 'initialize' then meth_name = 'new' singleton = true type = 'method' # force public end meth_obj = RDoc::AnyMethod.new '', meth_name meth_obj.c_function = function meth_obj.singleton = singleton || %w[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 .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 # -2 is Array '(*args)' elsif p_count == -1 then # argc, argv rb_scan_args body else args = (1..p_count).map { |i| "p#{i}" } "(#{args.join ', '})" end meth_obj.record_location @top_level if meth_obj.section_title class_obj.temporary_section = class_obj.add_section(meth_obj.section_title) end class_obj.add_method meth_obj @stats.add_method meth_obj meth_obj.visibility = :private if 'private_method' == type end end end |