summaryrefslogtreecommitdiff
path: root/lib/rdoc/generators/ri_generator.rb
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 20:28:44 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 20:28:44 +0000
commitbc8c73c42a552fcc1d414c3475c64099f5a246d6 (patch)
treeebee43a2f527178f880b89405e30d630158975b7 /lib/rdoc/generators/ri_generator.rb
parent6ef31af2d178fb4916150d317ceafe156fccdf65 (diff)
Put RDoc comments into array.c, and refine rdoc/ri to deal with stuff that arose
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/generators/ri_generator.rb')
-rw-r--r--lib/rdoc/generators/ri_generator.rb57
1 files changed, 39 insertions, 18 deletions
diff --git a/lib/rdoc/generators/ri_generator.rb b/lib/rdoc/generators/ri_generator.rb
index db86d744af..375c534923 100644
--- a/lib/rdoc/generators/ri_generator.rb
+++ b/lib/rdoc/generators/ri_generator.rb
@@ -100,8 +100,6 @@ module Generators
cls_desc.superclass = cls.superclass
cls_desc.comment = markup(cls.comment)
- cls_desc.method_list = method_list(cls)
-
cls_desc.attributes =cls.attributes.sort.map do |a|
RI::Attribute.new(a.name, a.rw, markup(a.comment))
end
@@ -114,16 +112,23 @@ module Generators
RI::IncludedModule.new(i.name)
end
- methods = method_list(cls)
+ class_methods, instance_methods = method_list(cls)
- cls_desc.method_list = methods.map do |m|
+ cls_desc.class_methods = class_methods.map do |m|
+ RI::MethodSummary.new(m.name)
+ end
+ cls_desc.instance_methods = instance_methods.map do |m|
RI::MethodSummary.new(m.name)
end
@ri_writer.remove_class(cls_desc)
@ri_writer.add_class(cls_desc)
- methods.each do |m|
+ class_methods.each do |m|
+ generate_method_info(cls_desc, m)
+ end
+
+ instance_methods.each do |m|
generate_method_info(cls_desc, m)
end
end
@@ -155,7 +160,8 @@ module Generators
private
- # return a list of methods that we'll be documenting
+ # return a list of class and instance methods that we'll be
+ # documenting
def method_list(cls)
list = cls.method_list
@@ -164,22 +170,37 @@ module Generators
m.visibility == :public || m.force_documentation
end
end
-
- list.sort
+
+ c = []
+ i = []
+ list.sort.each do |m|
+ if m.singleton
+ c << m
+ else
+ i << m
+ end
+ end
+ return c,i
end
def params_of(method)
- p = method.params.gsub(/\s*\#.*/, '')
- p = p.tr("\n", " ").squeeze(" ")
- p = "(" + p + ")" unless p[0] == ?(
-
- if (block = method.block_params)
- block.gsub!(/\s*\#.*/, '')
- block = block.tr("\n", " ").squeeze(" ")
- if block[0] == ?(
- block.sub!(/^\(/, '').sub!(/\)/, '')
+ params = method.params || ""
+
+ if params =~ /^!verb!(.*)/m
+ p = $1
+ else
+ p = params.gsub(/\s*\#.*/, '')
+ p = p.tr("\n", " ").squeeze(" ")
+ p = "(" + p + ")" unless p[0] == ?(
+
+ if (block = method.block_params)
+ block.gsub!(/\s*\#.*/, '')
+ block = block.tr("\n", " ").squeeze(" ")
+ if block[0] == ?(
+ block.sub!(/^\(/, '').sub!(/\)/, '')
+ end
+ p << " {|#{block.strip}| ...}"
end
- p << " {|#{block.strip}| ...}"
end
p
end