rdoc 6.11.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.
- checksums.yaml +4 -4
- data/lib/rdoc/code_object/alias.rb +2 -9
- data/lib/rdoc/code_object/any_method.rb +7 -12
- data/lib/rdoc/code_object/attr.rb +4 -7
- data/lib/rdoc/code_object/class_module.rb +37 -19
- data/lib/rdoc/code_object/constant.rb +1 -1
- data/lib/rdoc/code_object/context/section.rb +10 -68
- data/lib/rdoc/code_object/context.rb +4 -46
- data/lib/rdoc/code_object/method_attr.rb +2 -22
- data/lib/rdoc/code_object/require.rb +1 -1
- data/lib/rdoc/code_object/top_level.rb +4 -24
- data/lib/rdoc/code_object.rb +3 -35
- data/lib/rdoc/comment.rb +12 -5
- data/lib/rdoc/generator/darkfish.rb +92 -108
- data/lib/rdoc/generator/json_index.rb +1 -17
- data/lib/rdoc/generator/markup.rb +2 -2
- data/lib/rdoc/generator/pot/message_extractor.rb +2 -2
- data/lib/rdoc/generator/pot.rb +0 -5
- data/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +1 -30
- data/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +1 -1
- data/lib/rdoc/generator/template/darkfish/class.rhtml +15 -0
- data/lib/rdoc/generator/template/darkfish/css/rdoc.css +13 -0
- data/lib/rdoc/generator/template/darkfish/index.rhtml +4 -4
- data/lib/rdoc/markdown.kpeg +7 -5
- data/lib/rdoc/markdown.rb +34 -21
- data/lib/rdoc/markup/heading.rb +7 -1
- data/lib/rdoc/markup/to_html.rb +6 -1
- data/lib/rdoc/parser/c.rb +5 -8
- data/lib/rdoc/parser/changelog.rb +3 -2
- data/lib/rdoc/parser/prism_ruby.rb +109 -45
- data/lib/rdoc/parser/ruby.rb +8 -11
- data/lib/rdoc/parser/simple.rb +1 -1
- data/lib/rdoc/parser.rb +3 -3
- data/lib/rdoc/rdoc.rb +3 -18
- data/lib/rdoc/ri/driver.rb +28 -19
- data/lib/rdoc/rubygems_hook.rb +1 -7
- data/lib/rdoc/servlet.rb +8 -7
- data/lib/rdoc/stats.rb +2 -2
- data/lib/rdoc/store.rb +9 -13
- data/lib/rdoc/text.rb +2 -2
- data/lib/rdoc/version.rb +1 -1
- metadata +2 -4
- data/lib/rdoc/generator/template/darkfish/_sidebar_VCS_info.rhtml +0 -19
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 752c58278dac55778d56ab11ca257f5902224f23e0f0a50aa69e5868dfc3fb34
|
4
|
+
data.tar.gz: bf83b7a81ffb712d5b377308a4af2b35d59a5d0c394b9082fae938399410931f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
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
|
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,
|
214
|
-
add_alias RDoc::Alias.new(nil, @name, new_name,
|
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
|
26
|
-
super
|
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(
|
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
|
@@ -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
|
|
@@ -359,37 +375,39 @@ class RDoc::ClassModule < RDoc::Context
|
|
359
375
|
@name = array[1]
|
360
376
|
@full_name = array[2]
|
361
377
|
@superclass = array[3]
|
362
|
-
|
378
|
+
document = array[4]
|
379
|
+
|
380
|
+
@comment = RDoc::Comment.from_document document
|
363
381
|
|
364
|
-
@comment_location = if RDoc::Markup::Document ===
|
365
|
-
|
382
|
+
@comment_location = if RDoc::Markup::Document === document.parts.first then
|
383
|
+
document
|
366
384
|
else
|
367
|
-
RDoc::Markup::Document.new
|
385
|
+
RDoc::Markup::Document.new document
|
368
386
|
end
|
369
387
|
|
370
388
|
array[5].each do |name, rw, visibility, singleton, file|
|
371
389
|
singleton ||= false
|
372
390
|
visibility ||= :public
|
373
391
|
|
374
|
-
attr = RDoc::Attr.new nil, name, rw, nil, singleton
|
392
|
+
attr = RDoc::Attr.new nil, name, rw, nil, singleton: singleton
|
375
393
|
|
376
394
|
add_attribute attr
|
377
395
|
attr.visibility = visibility
|
378
396
|
attr.record_location RDoc::TopLevel.new file
|
379
397
|
end
|
380
398
|
|
381
|
-
array[6].each do |constant,
|
399
|
+
array[6].each do |constant, document, file|
|
382
400
|
case constant
|
383
401
|
when RDoc::Constant then
|
384
402
|
add_constant constant
|
385
403
|
else
|
386
|
-
constant = add_constant RDoc::Constant.new(constant, nil,
|
404
|
+
constant = add_constant RDoc::Constant.new(constant, nil, RDoc::Comment.from_document(document))
|
387
405
|
constant.record_location RDoc::TopLevel.new file
|
388
406
|
end
|
389
407
|
end
|
390
408
|
|
391
|
-
array[7].each do |name,
|
392
|
-
incl = add_include RDoc::Include.new(name,
|
409
|
+
array[7].each do |name, document, file|
|
410
|
+
incl = add_include RDoc::Include.new(name, RDoc::Comment.from_document(document))
|
393
411
|
incl.record_location RDoc::TopLevel.new file
|
394
412
|
end
|
395
413
|
|
@@ -398,16 +416,15 @@ class RDoc::ClassModule < RDoc::Context
|
|
398
416
|
@visibility = visibility
|
399
417
|
|
400
418
|
methods.each do |name, file|
|
401
|
-
method = RDoc::AnyMethod.new nil, name
|
402
|
-
method.singleton = true if type == 'class'
|
419
|
+
method = RDoc::AnyMethod.new nil, name, singleton: type == 'class'
|
403
420
|
method.record_location RDoc::TopLevel.new file
|
404
421
|
add_method method
|
405
422
|
end
|
406
423
|
end
|
407
424
|
end
|
408
425
|
|
409
|
-
array[9].each do |name,
|
410
|
-
ext = add_extend RDoc::Extend.new(name,
|
426
|
+
array[9].each do |name, document, file|
|
427
|
+
ext = add_extend RDoc::Extend.new(name, RDoc::Comment.from_document(document))
|
411
428
|
ext.record_location RDoc::TopLevel.new file
|
412
429
|
end if array[9] # Support Marshal version 1
|
413
430
|
|
@@ -444,7 +461,8 @@ class RDoc::ClassModule < RDoc::Context
|
|
444
461
|
|
445
462
|
document = document.merge other_document
|
446
463
|
|
447
|
-
@comment =
|
464
|
+
@comment = RDoc::Comment.from_document(document)
|
465
|
+
@comment_location = document
|
448
466
|
end
|
449
467
|
|
450
468
|
cm = class_module
|
@@ -612,7 +630,7 @@ class RDoc::ClassModule < RDoc::Context
|
|
612
630
|
# Path to this class or module for use with HTML generator output.
|
613
631
|
|
614
632
|
def path
|
615
|
-
http_url
|
633
|
+
http_url
|
616
634
|
end
|
617
635
|
|
618
636
|
##
|
@@ -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
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
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
|
-
|
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
|
217
|
-
|
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.
|
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
|
934
|
+
def http_url
|
977
935
|
path = name_for_path
|
978
936
|
path = path.gsub(/<<\s*(\w*)/, 'from-\1') if path =~ /<</
|
979
|
-
path =
|
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
|
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 =
|
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
|
|
@@ -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
|
177
|
-
|
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
|
|
@@ -214,9 +196,7 @@ class RDoc::TopLevel < RDoc::Context
|
|
214
196
|
initialize array[1]
|
215
197
|
|
216
198
|
@parser = array[2]
|
217
|
-
@comment = array[3]
|
218
|
-
|
219
|
-
@file_stat = nil
|
199
|
+
@comment = RDoc::Comment.from_document array[3]
|
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
|
229
|
+
http_url
|
250
230
|
end
|
251
231
|
|
252
232
|
def pretty_print q # :nodoc:
|