rdoc 6.7.0 → 6.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/ExampleMarkdown.md +2 -0
  3. data/ExampleRDoc.rdoc +2 -0
  4. data/History.rdoc +64 -62
  5. data/LICENSE.rdoc +2 -0
  6. data/README.rdoc +13 -0
  7. data/RI.md +842 -0
  8. data/TODO.rdoc +8 -7
  9. data/lib/rdoc/{alias.rb → code_object/alias.rb} +3 -10
  10. data/lib/rdoc/{any_method.rb → code_object/any_method.rb} +7 -12
  11. data/lib/rdoc/{attr.rb → code_object/attr.rb} +4 -7
  12. data/lib/rdoc/{class_module.rb → code_object/class_module.rb} +107 -20
  13. data/lib/rdoc/{constant.rb → code_object/constant.rb} +1 -1
  14. data/lib/rdoc/{context → code_object/context}/section.rb +10 -68
  15. data/lib/rdoc/{context.rb → code_object/context.rb} +4 -46
  16. data/lib/rdoc/{method_attr.rb → code_object/method_attr.rb} +19 -27
  17. data/lib/rdoc/{require.rb → code_object/require.rb} +1 -1
  18. data/lib/rdoc/{top_level.rb → code_object/top_level.rb} +10 -28
  19. data/lib/rdoc/code_object.rb +6 -32
  20. data/lib/rdoc/comment.rb +12 -5
  21. data/lib/rdoc/generator/darkfish.rb +121 -95
  22. data/lib/rdoc/generator/json_index.rb +1 -17
  23. data/lib/rdoc/generator/markup.rb +2 -2
  24. data/lib/rdoc/generator/pot/message_extractor.rb +3 -3
  25. data/lib/rdoc/generator/pot/po_entry.rb +1 -1
  26. data/lib/rdoc/generator/pot.rb +0 -5
  27. data/lib/rdoc/generator/template/darkfish/_head.rhtml +23 -0
  28. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -29
  29. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  30. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  31. data/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +20 -11
  32. data/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +3 -8
  33. data/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  34. data/lib/rdoc/generator/template/darkfish/class.rhtml +84 -43
  35. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +391 -397
  36. data/lib/rdoc/generator/template/darkfish/index.rhtml +11 -10
  37. data/lib/rdoc/generator/template/darkfish/js/darkfish.js +24 -1
  38. data/lib/rdoc/generator/template/darkfish/page.rhtml +5 -5
  39. data/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +10 -8
  40. data/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +5 -2
  41. data/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +11 -0
  42. data/lib/rdoc/markdown.kpeg +8 -6
  43. data/lib/rdoc/markdown.rb +55 -32
  44. data/lib/rdoc/markup/attribute_manager.rb +2 -2
  45. data/lib/rdoc/markup/formatter.rb +19 -12
  46. data/lib/rdoc/markup/heading.rb +7 -1
  47. data/lib/rdoc/markup/pre_process.rb +26 -6
  48. data/lib/rdoc/markup/to_bs.rb +1 -1
  49. data/lib/rdoc/markup/to_html.rb +7 -2
  50. data/lib/rdoc/markup/to_html_crossref.rb +63 -12
  51. data/lib/rdoc/markup/to_rdoc.rb +5 -5
  52. data/lib/rdoc/markup.rb +18 -13
  53. data/lib/rdoc/options.rb +90 -12
  54. data/lib/rdoc/parser/c.rb +30 -9
  55. data/lib/rdoc/parser/changelog.rb +5 -4
  56. data/lib/rdoc/parser/prism_ruby.rb +1092 -0
  57. data/lib/rdoc/parser/ripper_state_lex.rb +7 -305
  58. data/lib/rdoc/parser/ruby.rb +23 -17
  59. data/lib/rdoc/parser/simple.rb +1 -1
  60. data/lib/rdoc/parser.rb +5 -4
  61. data/lib/rdoc/rd/block_parser.rb +3 -3
  62. data/lib/rdoc/rd/inline_parser.rb +3 -3
  63. data/lib/rdoc/rdoc.rb +9 -21
  64. data/lib/rdoc/ri/driver.rb +85 -32
  65. data/lib/rdoc/rubygems_hook.rb +91 -15
  66. data/lib/rdoc/servlet.rb +8 -7
  67. data/lib/rdoc/stats.rb +2 -2
  68. data/lib/rdoc/store.rb +21 -13
  69. data/lib/rdoc/task.rb +2 -3
  70. data/lib/rdoc/text.rb +2 -2
  71. data/lib/rdoc/tom_doc.rb +1 -7
  72. data/lib/rdoc/version.rb +1 -1
  73. data/lib/rdoc.rb +22 -24
  74. data/lib/rubygems_plugin.rb +23 -0
  75. metadata +27 -28
  76. data/RI.rdoc +0 -57
  77. data/lib/rdoc/generator/template/darkfish/.document +0 -0
  78. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  79. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
  80. data/lib/rdoc/generator/template/json_index/.document +0 -1
  81. /data/lib/rdoc/{anon_class.rb → code_object/anon_class.rb} +0 -0
  82. /data/lib/rdoc/{extend.rb → code_object/extend.rb} +0 -0
  83. /data/lib/rdoc/{ghost_method.rb → code_object/ghost_method.rb} +0 -0
  84. /data/lib/rdoc/{include.rb → code_object/include.rb} +0 -0
  85. /data/lib/rdoc/{meta_method.rb → code_object/meta_method.rb} +0 -0
  86. /data/lib/rdoc/{mixin.rb → code_object/mixin.rb} +0 -0
  87. /data/lib/rdoc/{normal_class.rb → code_object/normal_class.rb} +0 -0
  88. /data/lib/rdoc/{normal_module.rb → code_object/normal_module.rb} +0 -0
  89. /data/lib/rdoc/{single_class.rb → code_object/single_class.rb} +0 -0
data/TODO.rdoc CHANGED
@@ -1,9 +1,10 @@
1
+ = TODO
1
2
  This file contains some things that might happen in RDoc, or might not.
2
3
  Forward Looking Statements applies.
3
4
 
4
- === RDoc::VERSION.succ
5
+ == RDoc::VERSION.succ
5
6
 
6
- Blockers:
7
+ === Blockers:
7
8
 
8
9
  * Update LICENSE to match ruby's switch
9
10
  * The alias keyword should not be bidirectional
@@ -13,7 +14,7 @@ Blockers:
13
14
  * Fix consumption of , after link like: RDoc[rdoc-ref:RDoc], <- comma here
14
15
  * Remove support for links like Matrix[*rows]
15
16
 
16
- Nice to have:
17
+ === Nice to have:
17
18
 
18
19
  * Parse only changed files (like in ruby)
19
20
  * Page of Glory (or Shame) in HTML output showing documentation coverage
@@ -26,9 +27,9 @@ Nice to have:
26
27
  * Global variable support
27
28
  * Provide the code_object to directive handlers
28
29
 
29
- === More Future
30
+ == More Future
30
31
 
31
- API changes to RDoc
32
+ === API changes to RDoc
32
33
 
33
34
  * RDoc::TopLevel#add_method should automatically create the appropriate method
34
35
  class rather than requiring one be passed in.
@@ -36,7 +37,7 @@ API changes to RDoc
36
37
  * Add versions to RDoc::Markup syntax tree marshal format
37
38
  * Comments can no longer be Strings
38
39
 
39
- === Crazy Ideas
40
+ == Crazy Ideas
40
41
 
41
42
  * Auto-normalize heading levels to look OK. It's weird to see an <h1> in
42
43
  the middle of a method section.
@@ -46,7 +47,7 @@ API changes to RDoc
46
47
  * Rename Context to Container
47
48
  * Rename NormalClass to Class
48
49
 
49
- === Accessibility
50
+ == Accessibility
50
51
 
51
52
  Page title in right hand side
52
53
 
@@ -23,7 +23,7 @@ class RDoc::Alias < RDoc::CodeObject
23
23
  ##
24
24
  # Is this an alias declared in a singleton context?
25
25
 
26
- attr_accessor :singleton
26
+ attr_reader :singleton
27
27
 
28
28
  ##
29
29
  # Source file token stream
@@ -34,7 +34,7 @@ class RDoc::Alias < RDoc::CodeObject
34
34
  # Creates a new Alias with a token stream of +text+ that aliases +old_name+
35
35
  # to +new_name+, has +comment+ and is a +singleton+ context.
36
36
 
37
- def initialize(text, old_name, new_name, comment, singleton = false)
37
+ def initialize(text, old_name, new_name, comment, singleton: false)
38
38
  super()
39
39
 
40
40
  @text = text
@@ -59,18 +59,11 @@ class RDoc::Alias < RDoc::CodeObject
59
59
  "#alias-#{type}-#{html_name}"
60
60
  end
61
61
 
62
- ##
63
- # Full old name including namespace
64
-
65
- def full_old_name
66
- @full_name || "#{parent.name}#{pretty_old_name}"
67
- end
68
-
69
62
  ##
70
63
  # HTML id-friendly version of +#new_name+.
71
64
 
72
65
  def html_name
73
- CGI.escape(@new_name.gsub('-', '-2D')).gsub('%','-').sub(/^-/, '')
66
+ CGI.escape(@new_name.gsub('-', '-2D')).gsub('%', '-').sub(/^-/, '')
74
67
  end
75
68
 
76
69
  def inspect # :nodoc:
@@ -29,10 +29,6 @@ class RDoc::AnyMethod < RDoc::MethodAttr
29
29
  # The section title of the method (if defined in a C file via +:category:+)
30
30
  attr_accessor :section_title
31
31
 
32
- # Parameters for this method
33
-
34
- attr_accessor :params
35
-
36
32
  ##
37
33
  # If true this method uses +super+ to call a superclass version
38
34
 
@@ -43,8 +39,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
43
39
  ##
44
40
  # Creates a new AnyMethod with a token stream +text+ and +name+
45
41
 
46
- def initialize text, name
47
- super
42
+ def initialize(text, name, singleton: false)
43
+ super(text, name, singleton: singleton)
48
44
 
49
45
  @c_function = nil
50
46
  @dont_rename_initialize = false
@@ -57,10 +53,9 @@ class RDoc::AnyMethod < RDoc::MethodAttr
57
53
  # Adds +an_alias+ as an alias for this method in +context+.
58
54
 
59
55
  def add_alias an_alias, context = nil
60
- method = self.class.new an_alias.text, an_alias.new_name
56
+ method = self.class.new an_alias.text, an_alias.new_name, singleton: singleton
61
57
 
62
58
  method.record_location an_alias.file
63
- method.singleton = self.singleton
64
59
  method.params = self.params
65
60
  method.visibility = self.visibility
66
61
  method.comment = an_alias.comment
@@ -110,7 +105,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
110
105
  # See also #param_seq
111
106
 
112
107
  def call_seq= call_seq
113
- return if call_seq.empty?
108
+ return if call_seq.nil? || call_seq.empty?
114
109
 
115
110
  @call_seq = call_seq
116
111
  end
@@ -198,7 +193,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
198
193
  @full_name = array[2]
199
194
  @singleton = array[3]
200
195
  @visibility = array[4]
201
- @comment = array[5]
196
+ @comment = RDoc::Comment.from_document array[5]
202
197
  @call_seq = array[6]
203
198
  @block_params = array[7]
204
199
  # 8 handled below
@@ -210,8 +205,8 @@ class RDoc::AnyMethod < RDoc::MethodAttr
210
205
  @section_title = array[14]
211
206
  @is_alias_for = array[15]
212
207
 
213
- array[8].each do |new_name, comment|
214
- add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
208
+ array[8].each do |new_name, document|
209
+ add_alias RDoc::Alias.new(nil, @name, new_name, RDoc::Comment.from_document(document), singleton: @singleton)
215
210
  end
216
211
 
217
212
  @parent_name ||= if @full_name =~ /#/ then
@@ -22,11 +22,10 @@ class RDoc::Attr < RDoc::MethodAttr
22
22
  # Creates a new Attr with body +text+, +name+, read/write status +rw+ and
23
23
  # +comment+. +singleton+ marks this as a class attribute.
24
24
 
25
- def initialize(text, name, rw, comment, singleton = false)
26
- super text, name
25
+ def initialize(text, name, rw, comment, singleton: false)
26
+ super(text, name, singleton: singleton)
27
27
 
28
28
  @rw = rw
29
- @singleton = singleton
30
29
  self.comment = comment
31
30
  end
32
31
 
@@ -44,9 +43,7 @@ class RDoc::Attr < RDoc::MethodAttr
44
43
  # Add +an_alias+ as an attribute in +context+.
45
44
 
46
45
  def add_alias(an_alias, context)
47
- new_attr = self.class.new(self.text, an_alias.new_name, self.rw,
48
- self.comment, self.singleton)
49
-
46
+ new_attr = self.class.new(text, an_alias.new_name, rw, comment, singleton: singleton)
50
47
  new_attr.record_location an_alias.file
51
48
  new_attr.visibility = self.visibility
52
49
  new_attr.is_alias_for = self
@@ -136,7 +133,7 @@ class RDoc::Attr < RDoc::MethodAttr
136
133
  @full_name = array[2]
137
134
  @rw = array[3]
138
135
  @visibility = array[4]
139
- @comment = array[5]
136
+ @comment = RDoc::Comment.from_document array[5]
140
137
  @singleton = array[6] || false # MARSHAL_VERSION == 0
141
138
  # 7 handled below
142
139
  @parent_name = array[8]
@@ -34,8 +34,6 @@ class RDoc::ClassModule < RDoc::Context
34
34
 
35
35
  attr_accessor :comment_location
36
36
 
37
- attr_accessor :diagram # :nodoc:
38
-
39
37
  ##
40
38
  # Class or module this constant is an alias for
41
39
 
@@ -56,7 +54,6 @@ class RDoc::ClassModule < RDoc::Context
56
54
 
57
55
  klass.parent = mod.parent
58
56
  klass.section = mod.section
59
- klass.viewer = mod.viewer
60
57
 
61
58
  klass.attributes.concat mod.attributes
62
59
  klass.method_list.concat mod.method_list
@@ -110,7 +107,6 @@ class RDoc::ClassModule < RDoc::Context
110
107
 
111
108
  def initialize(name, superclass = nil)
112
109
  @constant_aliases = []
113
- @diagram = nil
114
110
  @is_alias_for = nil
115
111
  @name = name
116
112
  @superclass = superclass
@@ -223,7 +219,9 @@ class RDoc::ClassModule < RDoc::Context
223
219
  def complete min_visibility
224
220
  update_aliases
225
221
  remove_nodoc_children
222
+ embed_mixins
226
223
  update_includes
224
+ update_extends
227
225
  remove_invisible min_visibility
228
226
  end
229
227
 
@@ -294,6 +292,25 @@ class RDoc::ClassModule < RDoc::Context
294
292
  end
295
293
  end
296
294
 
295
+ ##
296
+ # Return array of full_name splitted by +::+.
297
+
298
+ def nesting_namespaces
299
+ @namespaces ||= full_name.split("::").reject(&:empty?)
300
+ end
301
+
302
+ ##
303
+ # Return array of fully qualified nesting namespaces.
304
+ #
305
+ # For example, if full_name is +A::B::C+, this method returns <code>["A", "A::B", "A::B::C"]</code>
306
+
307
+ def fully_qualified_nesting_namespaces
308
+ return nesting_namespaces if nesting_namespaces.length < 2
309
+ @fqns ||= nesting_namespaces.inject([]) do |list, n|
310
+ list << (list.empty? ? n : "#{list.last}::#{n}")
311
+ end
312
+ end
313
+
297
314
  ##
298
315
  # TODO: filter included items by #display?
299
316
 
@@ -358,37 +375,39 @@ class RDoc::ClassModule < RDoc::Context
358
375
  @name = array[1]
359
376
  @full_name = array[2]
360
377
  @superclass = array[3]
361
- @comment = array[4]
378
+ document = array[4]
362
379
 
363
- @comment_location = if RDoc::Markup::Document === @comment.parts.first then
364
- @comment
380
+ @comment = RDoc::Comment.from_document document
381
+
382
+ @comment_location = if RDoc::Markup::Document === document.parts.first then
383
+ document
365
384
  else
366
- RDoc::Markup::Document.new @comment
385
+ RDoc::Markup::Document.new document
367
386
  end
368
387
 
369
388
  array[5].each do |name, rw, visibility, singleton, file|
370
389
  singleton ||= false
371
390
  visibility ||= :public
372
391
 
373
- attr = RDoc::Attr.new nil, name, rw, nil, singleton
392
+ attr = RDoc::Attr.new nil, name, rw, nil, singleton: singleton
374
393
 
375
394
  add_attribute attr
376
395
  attr.visibility = visibility
377
396
  attr.record_location RDoc::TopLevel.new file
378
397
  end
379
398
 
380
- array[6].each do |constant, comment, file|
399
+ array[6].each do |constant, document, file|
381
400
  case constant
382
401
  when RDoc::Constant then
383
402
  add_constant constant
384
403
  else
385
- constant = add_constant RDoc::Constant.new(constant, nil, comment)
404
+ constant = add_constant RDoc::Constant.new(constant, nil, RDoc::Comment.from_document(document))
386
405
  constant.record_location RDoc::TopLevel.new file
387
406
  end
388
407
  end
389
408
 
390
- array[7].each do |name, comment, file|
391
- incl = add_include RDoc::Include.new(name, comment)
409
+ array[7].each do |name, document, file|
410
+ incl = add_include RDoc::Include.new(name, RDoc::Comment.from_document(document))
392
411
  incl.record_location RDoc::TopLevel.new file
393
412
  end
394
413
 
@@ -397,16 +416,15 @@ class RDoc::ClassModule < RDoc::Context
397
416
  @visibility = visibility
398
417
 
399
418
  methods.each do |name, file|
400
- method = RDoc::AnyMethod.new nil, name
401
- method.singleton = true if type == 'class'
419
+ method = RDoc::AnyMethod.new nil, name, singleton: type == 'class'
402
420
  method.record_location RDoc::TopLevel.new file
403
421
  add_method method
404
422
  end
405
423
  end
406
424
  end
407
425
 
408
- array[9].each do |name, comment, file|
409
- ext = add_extend RDoc::Extend.new(name, comment)
426
+ array[9].each do |name, document, file|
427
+ ext = add_extend RDoc::Extend.new(name, RDoc::Comment.from_document(document))
410
428
  ext.record_location RDoc::TopLevel.new file
411
429
  end if array[9] # Support Marshal version 1
412
430
 
@@ -443,7 +461,8 @@ class RDoc::ClassModule < RDoc::Context
443
461
 
444
462
  document = document.merge other_document
445
463
 
446
- @comment = @comment_location = document
464
+ @comment = RDoc::Comment.from_document(document)
465
+ @comment_location = document
447
466
  end
448
467
 
449
468
  cm = class_module
@@ -611,7 +630,9 @@ class RDoc::ClassModule < RDoc::Context
611
630
  # Path to this class or module for use with HTML generator output.
612
631
 
613
632
  def path
614
- http_url @store.rdoc.generator.class_dir
633
+ prefix = options.class_module_path_prefix
634
+ return http_url unless prefix
635
+ File.join(prefix, http_url)
615
636
  end
616
637
 
617
638
  ##
@@ -704,10 +725,37 @@ class RDoc::ClassModule < RDoc::Context
704
725
 
705
726
  ##
706
727
  # Set the superclass of this class to +superclass+
728
+ #
729
+ # where +superclass+ is one of:
730
+ #
731
+ # - +nil+
732
+ # - a String containing the full name of the superclass
733
+ # - the RDoc::ClassModule representing the superclass
707
734
 
708
735
  def superclass=(superclass)
709
736
  raise NoMethodError, "#{full_name} is a module" if module?
710
- @superclass = superclass
737
+ case superclass
738
+ when RDoc::ClassModule
739
+ @superclass = superclass.full_name
740
+ when nil, String
741
+ @superclass = superclass
742
+ else
743
+ raise TypeError, "superclass must be a String or RDoc::ClassModule, not #{superclass.class}"
744
+ end
745
+ end
746
+
747
+ ##
748
+ # Get all super classes of this class in an array. The last element might be
749
+ # a string if the name is unknown.
750
+
751
+ def super_classes
752
+ result = []
753
+ parent = self
754
+ while parent = parent.superclass
755
+ result << parent
756
+ return result if parent.is_a?(String)
757
+ end
758
+ result
711
759
  end
712
760
 
713
761
  def to_s # :nodoc:
@@ -798,4 +846,43 @@ class RDoc::ClassModule < RDoc::Context
798
846
  extends.uniq!
799
847
  end
800
848
 
849
+ def embed_mixins
850
+ return unless options.embed_mixins
851
+
852
+ includes.each do |include|
853
+ next if String === include.module
854
+ include.module.method_list.each do |code_object|
855
+ add_method(prepare_to_embed(code_object))
856
+ end
857
+ include.module.constants.each do |code_object|
858
+ add_constant(prepare_to_embed(code_object))
859
+ end
860
+ include.module.attributes.each do |code_object|
861
+ add_attribute(prepare_to_embed(code_object))
862
+ end
863
+ end
864
+
865
+ extends.each do |ext|
866
+ next if String === ext.module
867
+ ext.module.method_list.each do |code_object|
868
+ add_method(prepare_to_embed(code_object, true))
869
+ end
870
+ ext.module.attributes.each do |code_object|
871
+ add_attribute(prepare_to_embed(code_object, true))
872
+ end
873
+ end
874
+ end
875
+
876
+ private
877
+
878
+ def prepare_to_embed(code_object, singleton=false)
879
+ code_object = code_object.dup
880
+ code_object.mixin_from = code_object.parent
881
+ code_object.singleton = true if singleton
882
+ set_current_section(code_object.section.title, code_object.section.comment)
883
+ # add_method and add_attribute will reassign self's visibility back to the method/attribute
884
+ # so we need to sync self's visibility with the object's to properly retain that information
885
+ self.visibility = code_object.visibility
886
+ code_object
887
+ end
801
888
  end
@@ -133,7 +133,7 @@ class RDoc::Constant < RDoc::CodeObject
133
133
  # * #parent_name
134
134
 
135
135
  def marshal_load array
136
- initialize array[1], nil, array[5]
136
+ initialize array[1], nil, RDoc::Comment.from_document(array[5])
137
137
 
138
138
  @full_name = array[2]
139
139
  @visibility = array[3] || :public
@@ -61,19 +61,10 @@ class RDoc::Context::Section
61
61
  # Adds +comment+ to this section
62
62
 
63
63
  def add_comment comment
64
- comment = extract_comment comment
65
-
66
- return if comment.empty?
67
-
68
- case comment
69
- when RDoc::Comment then
70
- @comments << comment
71
- when RDoc::Markup::Document then
72
- @comments.concat comment.parts
73
- when Array then
74
- @comments.concat comment
75
- else
76
- raise TypeError, "unknown comment type: #{comment.inspect}"
64
+ comments = Array(comment)
65
+ comments.each do |c|
66
+ extracted_comment = extract_comment(c)
67
+ @comments << extracted_comment unless extracted_comment.empty?
77
68
  end
78
69
  end
79
70
 
@@ -97,10 +88,6 @@ class RDoc::Context::Section
97
88
 
98
89
  def extract_comment comment
99
90
  case comment
100
- when Array then
101
- comment.map do |c|
102
- extract_comment c
103
- end
104
91
  when nil
105
92
  RDoc::Comment.new ''
106
93
  when RDoc::Comment then
@@ -115,8 +102,6 @@ class RDoc::Context::Section
115
102
  end
116
103
  end
117
104
 
118
- comment
119
- when RDoc::Markup::Document then
120
105
  comment
121
106
  else
122
107
  raise TypeError, "unknown comment #{comment.inspect}"
@@ -135,20 +120,7 @@ class RDoc::Context::Section
135
120
  # The files comments in this section come from
136
121
 
137
122
  def in_files
138
- return [] if @comments.empty?
139
-
140
- case @comments
141
- when Array then
142
- @comments.map do |comment|
143
- comment.file
144
- end
145
- when RDoc::Markup::Document then
146
- @comment.parts.map do |document|
147
- document.file
148
- end
149
- else
150
- raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
151
- end
123
+ @comments.map(&:file)
152
124
  end
153
125
 
154
126
  ##
@@ -170,7 +142,7 @@ class RDoc::Context::Section
170
142
  @parent = nil
171
143
 
172
144
  @title = array[1]
173
- @comments = array[2]
145
+ @comments = array[2].parts.map { |doc| RDoc::Comment.from_document(doc) }
174
146
  end
175
147
 
176
148
  ##
@@ -178,26 +150,7 @@ class RDoc::Context::Section
178
150
  # multiple RDoc::Markup::Documents with their file set.
179
151
 
180
152
  def parse
181
- case @comments
182
- when String then
183
- super
184
- when Array then
185
- docs = @comments.map do |comment, location|
186
- doc = super comment
187
- doc.file = location if location
188
- doc
189
- end
190
-
191
- RDoc::Markup::Document.new(*docs)
192
- when RDoc::Comment then
193
- doc = super @comments.text, comments.format
194
- doc.file = @comments.location
195
- doc
196
- when RDoc::Markup::Document then
197
- return @comments
198
- else
199
- raise ArgumentError, "unknown comment class #{comments.class}"
200
- end
153
+ RDoc::Markup::Document.new(*@comments.map(&:parse))
201
154
  end
202
155
 
203
156
  ##
@@ -213,20 +166,9 @@ class RDoc::Context::Section
213
166
  # Removes a comment from this section if it is from the same file as
214
167
  # +comment+
215
168
 
216
- def remove_comment comment
217
- return if @comments.empty?
218
-
219
- case @comments
220
- when Array then
221
- @comments.delete_if do |my_comment|
222
- my_comment.file == comment.file
223
- end
224
- when RDoc::Markup::Document then
225
- @comments.parts.delete_if do |document|
226
- document.file == comment.file.name
227
- end
228
- else
229
- raise RDoc::Error, "BUG: unknown comment class #{@comments.class}"
169
+ def remove_comment target_comment
170
+ @comments.delete_if do |stored_comment|
171
+ stored_comment.file == target_comment.file
230
172
  end
231
173
  end
232
174
 
@@ -482,7 +482,7 @@ class RDoc::Context < RDoc::CodeObject
482
482
  known.comment = method.comment if known.comment.empty?
483
483
  previously = ", previously in #{known.file}" unless
484
484
  method.file == known.file
485
- @store.rdoc.options.warn \
485
+ @store.options.warn \
486
486
  "Duplicate method #{known.full_name} in #{method.file}#{previously}"
487
487
  end
488
488
  else
@@ -688,13 +688,6 @@ class RDoc::Context < RDoc::CodeObject
688
688
  section
689
689
  end
690
690
 
691
- ##
692
- # Is part of this thing was defined in +file+?
693
-
694
- def defined_in?(file)
695
- @in_files.include?(file)
696
- end
697
-
698
691
  def display(method_attr) # :nodoc:
699
692
  if method_attr.is_a? RDoc::Attr
700
693
  "#{method_attr.definition} #{method_attr.pretty_name}"
@@ -713,13 +706,6 @@ class RDoc::Context < RDoc::CodeObject
713
706
  def each_ancestor(&_) # :nodoc:
714
707
  end
715
708
 
716
- ##
717
- # Iterator for attributes
718
-
719
- def each_attribute # :yields: attribute
720
- @attributes.each { |a| yield a }
721
- end
722
-
723
709
  ##
724
710
  # Iterator for classes and modules
725
711
 
@@ -727,27 +713,6 @@ class RDoc::Context < RDoc::CodeObject
727
713
  classes_and_modules.sort.each(&block)
728
714
  end
729
715
 
730
- ##
731
- # Iterator for constants
732
-
733
- def each_constant # :yields: constant
734
- @constants.each {|c| yield c}
735
- end
736
-
737
- ##
738
- # Iterator for included modules
739
-
740
- def each_include # :yields: include
741
- @includes.each do |i| yield i end
742
- end
743
-
744
- ##
745
- # Iterator for extension modules
746
-
747
- def each_extend # :yields: extend
748
- @extends.each do |e| yield e end
749
- end
750
-
751
716
  ##
752
717
  # Iterator for methods
753
718
 
@@ -847,13 +812,6 @@ class RDoc::Context < RDoc::CodeObject
847
812
  end
848
813
  end
849
814
 
850
- ##
851
- # Finds a file with +name+ in this context
852
-
853
- def find_file_named name
854
- @store.find_file_named name
855
- end
856
-
857
815
  ##
858
816
  # Finds an instance method with +name+ in this context
859
817
 
@@ -871,7 +829,7 @@ class RDoc::Context < RDoc::CodeObject
871
829
  find_attribute_named(symbol) or
872
830
  find_external_alias_named(symbol) or
873
831
  find_module_named(symbol) or
874
- find_file_named(symbol)
832
+ @store.find_file_named(symbol)
875
833
  end
876
834
 
877
835
  ##
@@ -973,10 +931,10 @@ class RDoc::Context < RDoc::CodeObject
973
931
  ##
974
932
  # URL for this with a +prefix+
975
933
 
976
- def http_url(prefix)
934
+ def http_url
977
935
  path = name_for_path
978
936
  path = path.gsub(/<<\s*(\w*)/, 'from-\1') if path =~ /<</
979
- path = [prefix] + path.split('::')
937
+ path = path.split('::')
980
938
 
981
939
  File.join(*path.compact) + '.html'
982
940
  end