1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Annotate enum.c. Add pager support, and report on methods in included modules

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dave 2003-12-18 21:08:25 +00:00
parent f75aff0139
commit 84f0b051de
12 changed files with 692 additions and 14 deletions

View file

@ -42,6 +42,8 @@ require 'rdoc/markup/simple_markup'
require 'rdoc/markup/simple_markup/to_flow'
require 'cgi'
require 'rdoc/ri/ri_cache'
require 'rdoc/ri/ri_reader'
require 'rdoc/ri/ri_writer'
require 'rdoc/ri/ri_descriptions'
@ -121,8 +123,7 @@ module Generators
RI::MethodSummary.new(m.name)
end
@ri_writer.remove_class(cls_desc)
@ri_writer.add_class(cls_desc)
update_or_replace(cls_desc)
class_methods.each do |m|
generate_method_info(cls_desc, m)
@ -219,5 +220,39 @@ module Generators
@markup.convert(content, @to_flow)
end
# By default we replace existing classes with the
# same name. If the --merge option was given, we instead
# merge this definition into an existing class. We add
# our methods, aliases, etc to that class, but do not
# change the class's description.
def update_or_replace(cls_desc)
old_cls = nil
if @options.merge
rdr = RI::RiReader.new(RI::RiCache.new(@options.op_dir))
namespace = rdr.top_level_namespace
namespace = rdr.lookup_namespace_in(cls_desc.name, namespace)
if namespace.empty?
raise RiError.new("Nothing known about #{arg}")
else
old_cls = namespace[0]
end
end
if old_cls.nil?
# no merge: simply overwrite
@ri_writer.remove_class(cls_desc)
@ri_writer.add_class(cls_desc)
else
# existing class: merge in
old_desc = rdr.get_class(old_cls)
old_desc.merge_in(cls_desc)
@ri_writer.add_class(old_desc)
end
end
end
end