rdoc 6.12.0 → 6.13.0

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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rdoc/code_object/alias.rb +2 -9
  3. data/lib/rdoc/code_object/any_method.rb +5 -10
  4. data/lib/rdoc/code_object/attr.rb +3 -6
  5. data/lib/rdoc/code_object/class_module.rb +23 -8
  6. data/lib/rdoc/code_object/context.rb +4 -46
  7. data/lib/rdoc/code_object/method_attr.rb +2 -22
  8. data/lib/rdoc/code_object/require.rb +1 -1
  9. data/lib/rdoc/code_object/top_level.rb +3 -23
  10. data/lib/rdoc/code_object.rb +3 -34
  11. data/lib/rdoc/comment.rb +1 -4
  12. data/lib/rdoc/generator/darkfish.rb +84 -96
  13. data/lib/rdoc/generator/json_index.rb +1 -17
  14. data/lib/rdoc/generator/markup.rb +2 -2
  15. data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
  16. data/lib/rdoc/generator/pot.rb +0 -5
  17. data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
  18. data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
  19. data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
  20. data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
  21. data/lib/rdoc/generator/template/darkfish/css/rdoc.css +13 -0
  22. data/lib/rdoc/markdown.kpeg +7 -5
  23. data/lib/rdoc/markdown.rb +34 -21
  24. data/lib/rdoc/markup/heading.rb +7 -1
  25. data/lib/rdoc/markup/to_html.rb +6 -1
  26. data/lib/rdoc/parser/c.rb +4 -7
  27. data/lib/rdoc/parser/prism_ruby.rb +8 -15
  28. data/lib/rdoc/parser/ruby.rb +7 -10
  29. data/lib/rdoc/rdoc.rb +3 -18
  30. data/lib/rdoc/ri/driver.rb +11 -3
  31. data/lib/rdoc/rubygems_hook.rb +1 -7
  32. data/lib/rdoc/servlet.rb +8 -7
  33. data/lib/rdoc/stats.rb +2 -2
  34. data/lib/rdoc/store.rb +9 -13
  35. data/lib/rdoc/text.rb +2 -2
  36. data/lib/rdoc/version.rb +1 -1
  37. metadata +2 -4
  38. data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
  39. data/lib/rdoc/generator/template/darkfish/_sidebar_in_files.rhtml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7a81c2ecc4bf154e3dd627e46fb8128cd9b953b2d5108c95fab803049a45fe1
4
- data.tar.gz: 6307f1c96724b63e01642814567c798f8a2f5e268c105429cf64c92581bec632
3
+ metadata.gz: 752c58278dac55778d56ab11ca257f5902224f23e0f0a50aa69e5868dfc3fb34
4
+ data.tar.gz: bf83b7a81ffb712d5b377308a4af2b35d59a5d0c394b9082fae938399410931f
5
5
  SHA512:
6
- metadata.gz: 3aa0ba6de344876c71c6a749795d81854718397741fe5c9c910b9f43da039cf383130451a6ea779575069b61c5b618f9dae40c8fdc9fddec7bc90a36e1ae8b55
7
- data.tar.gz: ff19a385007977c9a7234e87181982d5a96c3c80bc5f8b79e5ae95aeda6a75348ece0a76c8d18ea21b55826a7c2471307bfd1eb4d6f15fcee49812ed3458b66d
6
+ metadata.gz: 85231fbcadaf3c4890808169e0ee5ffb83083a58dc803f8c67048fbfef9ff718f0d595d09b56772d916b7233a819fcf23874fc8386e65b5e9902e3f3b451e27a
7
+ data.tar.gz: 63a2be58e2972b5aea4c57fc7c617246403de2c8e4436954225753d3271026311d2cc40344ffe15232a7df139af623994b012e6514bca940c724cb0da5a441a9
@@ -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,13 +59,6 @@ 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
 
@@ -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
@@ -211,7 +206,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
211
206
  @is_alias_for = array[15]
212
207
 
213
208
  array[8].each do |new_name, document|
214
- add_alias RDoc::Alias.new(nil, @name, new_name, RDoc::Comment.from_document(document), @singleton)
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
@@ -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
@@ -225,6 +221,7 @@ class RDoc::ClassModule < RDoc::Context
225
221
  remove_nodoc_children
226
222
  embed_mixins
227
223
  update_includes
224
+ update_extends
228
225
  remove_invisible min_visibility
229
226
  end
230
227
 
@@ -295,6 +292,25 @@ class RDoc::ClassModule < RDoc::Context
295
292
  end
296
293
  end
297
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
+
298
314
  ##
299
315
  # TODO: filter included items by #display?
300
316
 
@@ -373,7 +389,7 @@ class RDoc::ClassModule < RDoc::Context
373
389
  singleton ||= false
374
390
  visibility ||= :public
375
391
 
376
- attr = RDoc::Attr.new nil, name, rw, nil, singleton
392
+ attr = RDoc::Attr.new nil, name, rw, nil, singleton: singleton
377
393
 
378
394
  add_attribute attr
379
395
  attr.visibility = visibility
@@ -400,8 +416,7 @@ class RDoc::ClassModule < RDoc::Context
400
416
  @visibility = visibility
401
417
 
402
418
  methods.each do |name, file|
403
- method = RDoc::AnyMethod.new nil, name
404
- method.singleton = true if type == 'class'
419
+ method = RDoc::AnyMethod.new nil, name, singleton: type == 'class'
405
420
  method.record_location RDoc::TopLevel.new file
406
421
  add_method method
407
422
  end
@@ -615,7 +630,7 @@ class RDoc::ClassModule < RDoc::Context
615
630
  # Path to this class or module for use with HTML generator output.
616
631
 
617
632
  def path
618
- http_url @store.rdoc.generator.class_dir
633
+ http_url
619
634
  end
620
635
 
621
636
  ##
@@ -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
@@ -63,19 +63,13 @@ class RDoc::MethodAttr < RDoc::CodeObject
63
63
 
64
64
  attr_reader :arglists
65
65
 
66
- ##
67
- # Pretty parameter list for this method
68
-
69
- attr_reader :param_seq
70
-
71
-
72
66
  ##
73
67
  # Creates a new MethodAttr from token stream +text+ and method or attribute
74
68
  # name +name+.
75
69
  #
76
70
  # Usually this is called by super from a subclass.
77
71
 
78
- def initialize text, name
72
+ def initialize(text, name, singleton: false)
79
73
  super()
80
74
 
81
75
  @text = text
@@ -84,14 +78,13 @@ class RDoc::MethodAttr < RDoc::CodeObject
84
78
  @aliases = []
85
79
  @is_alias_for = nil
86
80
  @parent_name = nil
87
- @singleton = nil
81
+ @singleton = singleton
88
82
  @visibility = :public
89
83
  @see = false
90
84
 
91
85
  @arglists = nil
92
86
  @block_params = nil
93
87
  @call_seq = nil
94
- @param_seq = nil
95
88
  @params = nil
96
89
  end
97
90
 
@@ -320,19 +313,6 @@ class RDoc::MethodAttr < RDoc::CodeObject
320
313
  @singleton ? '::' : '#'
321
314
  end
322
315
 
323
- ##
324
- # Name for output to HTML. For class methods the full name with a "." is
325
- # used like +SomeClass.method_name+. For instance methods the class name is
326
- # used if +context+ does not match the parent.
327
- #
328
- # This is to help prevent people from using :: to call class methods.
329
-
330
- def output_name context
331
- return "#{name_prefix}#{@name}" if context == parent
332
-
333
- "#{parent_name}#{@singleton ? '.' : '#'}#{@name}"
334
- end
335
-
336
316
  ##
337
317
  # Method/attribute name with class/instance indicator
338
318
 
@@ -24,7 +24,7 @@ class RDoc::Require < RDoc::CodeObject
24
24
  self.class,
25
25
  object_id,
26
26
  @name,
27
- parent_file_name,
27
+ @parent ? @parent.base_name : '(unknown)'
28
28
  ]
29
29
  end
30
30
 
@@ -6,11 +6,6 @@ class RDoc::TopLevel < RDoc::Context
6
6
 
7
7
  MARSHAL_VERSION = 0 # :nodoc:
8
8
 
9
- ##
10
- # This TopLevel's File::Stat struct
11
-
12
- attr_accessor :file_stat
13
-
14
9
  ##
15
10
  # Relative name of this file
16
11
 
@@ -28,8 +23,6 @@ class RDoc::TopLevel < RDoc::Context
28
23
 
29
24
  attr_reader :classes_or_modules
30
25
 
31
- attr_accessor :diagram # :nodoc:
32
-
33
26
  ##
34
27
  # The parser class that processed this file
35
28
 
@@ -45,8 +38,6 @@ class RDoc::TopLevel < RDoc::Context
45
38
  @name = nil
46
39
  @absolute_name = absolute_name
47
40
  @relative_name = relative_name
48
- @file_stat = File.stat(absolute_name) rescue nil # HACK for testing
49
- @diagram = nil
50
41
  @parser = nil
51
42
 
52
43
  @classes_or_modules = []
@@ -173,10 +164,8 @@ class RDoc::TopLevel < RDoc::Context
173
164
  ##
174
165
  # URL for this with a +prefix+
175
166
 
176
- def http_url(prefix)
177
- path = [prefix, @relative_name.tr('.', '_')]
178
-
179
- File.join(*path.compact) + '.html'
167
+ def http_url
168
+ @relative_name.tr('.', '_') + '.html'
180
169
  end
181
170
 
182
171
  def inspect # :nodoc:
@@ -188,13 +177,6 @@ class RDoc::TopLevel < RDoc::Context
188
177
  ]
189
178
  end
190
179
 
191
- ##
192
- # Time this file was last modified, if known
193
-
194
- def last_modified
195
- @file_stat ? file_stat.mtime : nil
196
- end
197
-
198
180
  ##
199
181
  # Dumps this TopLevel for use by ri. See also #marshal_load
200
182
 
@@ -215,8 +197,6 @@ class RDoc::TopLevel < RDoc::Context
215
197
 
216
198
  @parser = array[2]
217
199
  @comment = RDoc::Comment.from_document array[3]
218
-
219
- @file_stat = nil
220
200
  end
221
201
 
222
202
  ##
@@ -246,7 +226,7 @@ class RDoc::TopLevel < RDoc::Context
246
226
  # Path to this file for use with HTML generator output.
247
227
 
248
228
  def path
249
- http_url @store.rdoc.generator.file_dir
229
+ http_url
250
230
  end
251
231
 
252
232
  def pretty_print q # :nodoc:
@@ -21,9 +21,10 @@
21
21
  # * RDoc::MetaMethod
22
22
  # * RDoc::Alias
23
23
  # * RDoc::Constant
24
+ # * RDoc::Require
24
25
  # * RDoc::Mixin
25
- # * RDoc::Require
26
26
  # * RDoc::Include
27
+ # * RDoc::Extend
27
28
 
28
29
  class RDoc::CodeObject
29
30
 
@@ -89,13 +90,6 @@ class RDoc::CodeObject
89
90
 
90
91
  attr_reader :store
91
92
 
92
- ##
93
- # We are the model of the code, but we know that at some point we will be
94
- # worked on by viewers. By implementing the Viewable protocol, viewers can
95
- # associated themselves with these objects.
96
-
97
- attr_accessor :viewer
98
-
99
93
  ##
100
94
  # When mixed-in to a class, this points to the Context in which it was originally defined.
101
95
 
@@ -216,20 +210,6 @@ class RDoc::CodeObject
216
210
  @document_children = @document_self
217
211
  end
218
212
 
219
- ##
220
- # Yields each parent of this CodeObject. See also
221
- # RDoc::ClassModule#each_ancestor
222
-
223
- def each_parent
224
- code_object = self
225
-
226
- while code_object = code_object.parent do
227
- yield code_object
228
- end
229
-
230
- self
231
- end
232
-
233
213
  ##
234
214
  # File name where this CodeObject was found.
235
215
  #
@@ -300,11 +280,7 @@ class RDoc::CodeObject
300
280
  # This is used by Text#snippet
301
281
 
302
282
  def options
303
- if @store and @store.rdoc then
304
- @store.rdoc.options
305
- else
306
- RDoc::Options.new
307
- end
283
+ @store&.options || RDoc::Options.new
308
284
  end
309
285
 
310
286
  ##
@@ -330,13 +306,6 @@ class RDoc::CodeObject
330
306
  end
331
307
  end
332
308
 
333
- ##
334
- # File name of our parent
335
-
336
- def parent_file_name
337
- @parent ? @parent.base_name : '(unknown)'
338
- end
339
-
340
309
  ##
341
310
  # Name of our parent
342
311
 
data/lib/rdoc/comment.rb CHANGED
@@ -92,7 +92,7 @@ class RDoc::Comment
92
92
  # # ARGF.to_a(limit) -> array
93
93
  # # ARGF.to_a(sep, limit) -> array
94
94
 
95
- def extract_call_seq method
95
+ def extract_call_seq
96
96
  # we must handle situations like the above followed by an unindented first
97
97
  # comment. The difficulty is to make sure not to match lines starting
98
98
  # with ARGF at the same indent, but that are after the first description
@@ -116,10 +116,7 @@ class RDoc::Comment
116
116
  @text.slice! all_start...all_stop
117
117
 
118
118
  seq.gsub!(/^\s*/, '')
119
- method.call_seq = seq
120
119
  end
121
-
122
- method
123
120
  end
124
121
 
125
122
  ##