Method: RDoc::Context#add_method
- Defined in:
- lib/rdoc/code_object/context.rb
#add_method(method) ⇒ Object
Adds method
if not already there. If it is (as method or attribute), updates the comment if it was empty.
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/rdoc/code_object/context.rb', line 473 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..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 |