method
add_method
v2_6_3 -
Show latest stable
- Class:
RDoc::Context
add_method(method)public
Adds method if not already there. If it is (as method or attribute), updates the comment if it was empty.
# File lib/rdoc/context.rb, line 475
def add_method method
return method unless @document_self
# HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)
key = method.pretty_name
known = @methods_hash[key]
if known then
if @store then # otherwise we are loading
known.comment = method.comment if known.comment.empty?
previously = ", previously in #{known.file}" unless
method.file == known.file
@store.rdoc.options.warn "Duplicate method #{known.full_name} in #{method.file}#{previously}"
end
else
@methods_hash[key] = method
if @current_line_visibility
method.visibility, @current_line_visibility = @current_line_visibility, nil
else
method.visibility = @visibility
end
add_to @method_list, method
resolve_aliases method
end
method
end Related methods
- Instance methods
- <=>
- add
- add_alias
- add_attribute
- add_class
- add_class_or_module
- add_constant
- add_extend
- add_include
- add_method
- add_module
- add_module_alias
- add_module_by_normal_module
- add_require
- add_section
- add_to
- any_content
- child_name
- class_attributes
- class_method_list
- classes
- classes_and_modules
- classes_hash
- current_section
- defined_in?
- display
- each_ancestor
- each_attribute
- each_classmodule
- each_constant
- each_extend
- each_include
- each_method
- each_section
- find_attribute
- find_attribute_named
- find_class_method_named
- find_constant_named
- find_enclosing_module_named
- find_external_alias
- find_external_alias_named
- find_file_named
- find_instance_method_named
- find_local_symbol
- find_method
- find_method_named
- find_module_named
- find_symbol
- find_symbol_module
- full_name
- fully_documented?
- http_url
- initialize_methods_etc
- instance_attributes
- instance_method_list
- methods_by_type
- methods_matching
- modules
- modules_hash
- name_for_path
- ongoing_visibility=
- record_location
- remove_from_documentation?
- remove_invisible
- remove_invisible_in
- resolve_aliases
- section_contents
- sections
- sections_hash
- set_constant_visibility_for
- set_current_section
- set_visibility_for
- sort_sections
- to_s
- top_level
- upgrade_to_class
- Class methods
- new