class RDoc::Context

def add_method method

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
    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}"
  else
    @methods_hash[key] = method
    method.visibility = @visibility
    add_to @method_list, method
    resolve_aliases method
  end
  method
end