rdoc 3.6.1 → 3.7
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rdoc might be problematic. Click here for more details.
- data.tar.gz.sig +0 -0
- data/History.txt +45 -0
- data/Manifest.txt +4 -0
- data/lib/rdoc.rb +3 -2
- data/lib/rdoc/any_method.rb +12 -7
- data/lib/rdoc/attr.rb +16 -1
- data/lib/rdoc/class_module.rb +156 -42
- data/lib/rdoc/code_object.rb +8 -1
- data/lib/rdoc/context.rb +75 -29
- data/lib/rdoc/generator/markup.rb +3 -1
- data/lib/rdoc/generator/ri.rb +3 -2
- data/lib/rdoc/generator/template/darkfish/rdoc.css +4 -0
- data/lib/rdoc/known_classes.rb +2 -2
- data/lib/rdoc/markup.rb +63 -18
- data/lib/rdoc/markup/document.rb +43 -4
- data/lib/rdoc/markup/formatter.rb +13 -3
- data/lib/rdoc/markup/formatter_test_case.rb +13 -3
- data/lib/rdoc/markup/indented_paragraph.rb +33 -0
- data/lib/rdoc/markup/inline.rb +8 -1
- data/lib/rdoc/markup/parser.rb +1 -0
- data/lib/rdoc/markup/pre_process.rb +7 -0
- data/lib/rdoc/markup/to_ansi.rb +4 -4
- data/lib/rdoc/markup/to_bs.rb +1 -1
- data/lib/rdoc/markup/to_html.rb +2 -2
- data/lib/rdoc/markup/to_html_crossref.rb +3 -2
- data/lib/rdoc/markup/to_rdoc.rb +10 -1
- data/lib/rdoc/markup/to_test.rb +1 -1
- data/lib/rdoc/markup/to_tt_only.rb +1 -1
- data/lib/rdoc/parser.rb +1 -1
- data/lib/rdoc/parser/c.rb +69 -26
- data/lib/rdoc/parser/ruby.rb +19 -9
- data/lib/rdoc/rdoc.rb +14 -3
- data/lib/rdoc/ri/driver.rb +137 -103
- data/lib/rdoc/ri/store.rb +111 -26
- data/lib/rdoc/ruby_lex.rb +1 -1
- data/lib/rdoc/rubygems_hook.rb +220 -0
- data/lib/rdoc/text.rb +1 -1
- data/lib/rdoc/top_level.rb +31 -0
- data/test/test_rdoc_any_method.rb +68 -0
- data/test/test_rdoc_attr.rb +62 -0
- data/test/test_rdoc_class_module.rb +459 -29
- data/test/test_rdoc_code_object.rb +17 -0
- data/test/test_rdoc_context.rb +70 -0
- data/test/test_rdoc_context_section.rb +1 -1
- data/test/test_rdoc_generator_ri.rb +14 -3
- data/test/test_rdoc_markup.rb +55 -1
- data/test/test_rdoc_markup_document.rb +83 -0
- data/test/test_rdoc_markup_indented_paragraph.rb +40 -0
- data/test/test_rdoc_markup_paragraph.rb +12 -0
- data/test/test_rdoc_markup_pre_process.rb +13 -2
- data/test/test_rdoc_markup_to_ansi.rb +4 -0
- data/test/test_rdoc_markup_to_bs.rb +4 -0
- data/test/test_rdoc_markup_to_html.rb +7 -3
- data/test/test_rdoc_markup_to_rdoc.rb +14 -0
- data/test/test_rdoc_markup_to_tt_only.rb +4 -0
- data/test/test_rdoc_parser_c.rb +302 -2
- data/test/test_rdoc_parser_ruby.rb +48 -1
- data/test/test_rdoc_rdoc.rb +41 -10
- data/test/test_rdoc_ri_driver.rb +40 -7
- data/test/test_rdoc_ri_store.rb +111 -23
- data/test/test_rdoc_rubygems_hook.rb +201 -0
- data/test/test_rdoc_stats.rb +12 -12
- data/test/test_rdoc_text.rb +17 -0
- data/test/test_rdoc_top_level.rb +35 -0
- metadata +18 -14
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
@@ -1,3 +1,48 @@
|
|
1
|
+
=== 3.7 / 2011-06-27
|
2
|
+
|
3
|
+
* Minor enhancements
|
4
|
+
* New directive :category: which allows methods to be grouped into sections
|
5
|
+
more cleanly. See RDoc::Markup for details.
|
6
|
+
* Document-class for RDoc::Parser::C now supports Foo::CONST as well as
|
7
|
+
CONST.
|
8
|
+
* ri method output is now a comma-separated list when displayed
|
9
|
+
interactively. Pull Request #39 by Benoit Daloze.
|
10
|
+
* RDoc::ClassModule#merge now prefers the argument's information over the
|
11
|
+
receiver's (it now behaves like Hash#merge! instead of a backwards
|
12
|
+
Hash#merge!).
|
13
|
+
* RDoc::Markup#convert now accepts an RDoc::Markup::Document instance
|
14
|
+
* RDoc now owns the code for generating RDoc and ri data when gems install
|
15
|
+
* Added RDoc::RDoc::reset
|
16
|
+
* Added RDoc::CodeObject#file_name
|
17
|
+
* Bug fixes
|
18
|
+
* ri no longer crashes when attempting to complete a plain [.
|
19
|
+
* ri data now tracks which file information came from so it can process
|
20
|
+
removals and changes to:
|
21
|
+
* Classes and Modules
|
22
|
+
* Methods
|
23
|
+
* Attributes
|
24
|
+
* Includes
|
25
|
+
* Constants
|
26
|
+
You will need to rebuild your ri data for it to update properly. Issue
|
27
|
+
#21 by Sven Riedel
|
28
|
+
* Signal and SignalException no longer clobber each other
|
29
|
+
* RDoc::Parser::C no longer creates classes when processing aliases.
|
30
|
+
* RDoc::Text#strip_stars handles Document-method for methods with =, ! and ?
|
31
|
+
now.
|
32
|
+
* RDoc::Parser::C now allows .cpp files to be used with the "in" comment on
|
33
|
+
rb_define_method. Bug #35 by Hanmac.
|
34
|
+
* RDoc::Parser::Ruby no longer eats content when =begin/=end documentation
|
35
|
+
blocks are followed by a documentable item. Issue #41 by mfn.
|
36
|
+
* RDoc::Markup::Formatter and subclasses now allow an optional +markup+
|
37
|
+
parameter for adding custom markup. The example in
|
38
|
+
RDoc::Markup::Formatter will now work. Issue #38 by tsilen.
|
39
|
+
* RDoc::Parser::C can now distinguish between class methods and instance
|
40
|
+
methods in Document-method. Issue #36 by Vincent Batts.
|
41
|
+
* RDoc now encodes file names in the output encoding. Issue #33 by Perry
|
42
|
+
Smith.
|
43
|
+
* ri data generation for method aliases no longer duplicates the class in
|
44
|
+
#full_name
|
45
|
+
|
1
46
|
=== 3.6.1 / 2011-05-15
|
2
47
|
|
3
48
|
* Bug fixes
|
data/Manifest.txt
CHANGED
@@ -64,6 +64,7 @@ lib/rdoc/markup/document.rb
|
|
64
64
|
lib/rdoc/markup/formatter.rb
|
65
65
|
lib/rdoc/markup/formatter_test_case.rb
|
66
66
|
lib/rdoc/markup/heading.rb
|
67
|
+
lib/rdoc/markup/indented_paragraph.rb
|
67
68
|
lib/rdoc/markup/inline.rb
|
68
69
|
lib/rdoc/markup/list.rb
|
69
70
|
lib/rdoc/markup/list_item.rb
|
@@ -100,6 +101,7 @@ lib/rdoc/ri/paths.rb
|
|
100
101
|
lib/rdoc/ri/store.rb
|
101
102
|
lib/rdoc/ruby_lex.rb
|
102
103
|
lib/rdoc/ruby_token.rb
|
104
|
+
lib/rdoc/rubygems_hook.rb
|
103
105
|
lib/rdoc/single_class.rb
|
104
106
|
lib/rdoc/stats.rb
|
105
107
|
lib/rdoc/stats/normal.rb
|
@@ -132,6 +134,7 @@ test/test_rdoc_include.rb
|
|
132
134
|
test/test_rdoc_markup.rb
|
133
135
|
test/test_rdoc_markup_attribute_manager.rb
|
134
136
|
test/test_rdoc_markup_document.rb
|
137
|
+
test/test_rdoc_markup_indented_paragraph.rb
|
135
138
|
test/test_rdoc_markup_paragraph.rb
|
136
139
|
test/test_rdoc_markup_parser.rb
|
137
140
|
test/test_rdoc_markup_pre_process.rb
|
@@ -156,6 +159,7 @@ test/test_rdoc_ri_driver.rb
|
|
156
159
|
test/test_rdoc_ri_paths.rb
|
157
160
|
test/test_rdoc_ri_store.rb
|
158
161
|
test/test_rdoc_ruby_lex.rb
|
162
|
+
test/test_rdoc_rubygems_hook.rb
|
159
163
|
test/test_rdoc_single_class.rb
|
160
164
|
test/test_rdoc_stats.rb
|
161
165
|
test/test_rdoc_task.rb
|
data/lib/rdoc.rb
CHANGED
@@ -27,7 +27,8 @@ $DEBUG_RDOC = nil
|
|
27
27
|
# * If you want to use RDoc to create documentation for your Ruby source files,
|
28
28
|
# see RDoc::Markup and refer to <tt>rdoc --help</tt> for command line
|
29
29
|
# usage.
|
30
|
-
# * If you want to
|
30
|
+
# * If you want to write documentation for Ruby files see RDoc::Parser::Ruby
|
31
|
+
# * If you want to write documentation for extensions written in C see
|
31
32
|
# RDoc::Parser::C
|
32
33
|
# * If you want to generate documentation using <tt>rake</tt> see RDoc::Task.
|
33
34
|
# * If you want to drive RDoc programmatically, see RDoc::RDoc.
|
@@ -103,7 +104,7 @@ module RDoc
|
|
103
104
|
##
|
104
105
|
# RDoc version you are using
|
105
106
|
|
106
|
-
VERSION = '3.
|
107
|
+
VERSION = '3.7'
|
107
108
|
|
108
109
|
##
|
109
110
|
# Method visibilities
|
data/lib/rdoc/any_method.rb
CHANGED
@@ -6,7 +6,7 @@ require 'rdoc/token_stream'
|
|
6
6
|
|
7
7
|
class RDoc::AnyMethod < RDoc::MethodAttr
|
8
8
|
|
9
|
-
MARSHAL_VERSION =
|
9
|
+
MARSHAL_VERSION = 1 # :nodoc:
|
10
10
|
|
11
11
|
##
|
12
12
|
# Don't rename \#initialize to \::new
|
@@ -44,7 +44,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
44
44
|
##
|
45
45
|
# Adds +an_alias+ as an alias for this method in +context+.
|
46
46
|
|
47
|
-
def add_alias
|
47
|
+
def add_alias an_alias, context = nil
|
48
48
|
method = self.class.new an_alias.text, an_alias.new_name
|
49
49
|
|
50
50
|
method.record_location an_alias.file
|
@@ -54,7 +54,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
54
54
|
method.comment = an_alias.comment
|
55
55
|
method.is_alias_for = self
|
56
56
|
@aliases << method
|
57
|
-
context.add_method
|
57
|
+
context.add_method method if context
|
58
58
|
method
|
59
59
|
end
|
60
60
|
|
@@ -83,7 +83,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
83
83
|
|
84
84
|
def marshal_dump
|
85
85
|
aliases = @aliases.map do |a|
|
86
|
-
[a.
|
86
|
+
[a.name, parse(a.comment)]
|
87
87
|
end
|
88
88
|
|
89
89
|
[ MARSHAL_VERSION,
|
@@ -96,6 +96,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
96
96
|
@block_params,
|
97
97
|
aliases,
|
98
98
|
@params,
|
99
|
+
@file.absolute_name,
|
99
100
|
]
|
100
101
|
end
|
101
102
|
|
@@ -112,6 +113,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
112
113
|
@token_stream = nil
|
113
114
|
@aliases = []
|
114
115
|
|
116
|
+
version = array[0]
|
115
117
|
@name = array[1]
|
116
118
|
@full_name = array[2]
|
117
119
|
@singleton = array[3]
|
@@ -119,6 +121,11 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
119
121
|
@comment = array[5]
|
120
122
|
@call_seq = array[6]
|
121
123
|
@block_params = array[7]
|
124
|
+
|
125
|
+
array[8].each do |new_name, comment|
|
126
|
+
add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
|
127
|
+
end
|
128
|
+
|
122
129
|
@params = array[9]
|
123
130
|
|
124
131
|
@parent_name = if @full_name =~ /#/ then
|
@@ -129,9 +136,7 @@ class RDoc::AnyMethod < RDoc::MethodAttr
|
|
129
136
|
name.join '::'
|
130
137
|
end
|
131
138
|
|
132
|
-
array[
|
133
|
-
add_alias RDoc::Alias.new(nil, @name, new_name, comment, @singleton)
|
134
|
-
end
|
139
|
+
@file = RDoc::TopLevel.new array[10] if version > 0
|
135
140
|
end
|
136
141
|
|
137
142
|
##
|
data/lib/rdoc/attr.rb
CHANGED
@@ -6,7 +6,7 @@ require 'rdoc/method_attr'
|
|
6
6
|
|
7
7
|
class RDoc::Attr < RDoc::MethodAttr
|
8
8
|
|
9
|
-
MARSHAL_VERSION =
|
9
|
+
MARSHAL_VERSION = 2 # :nodoc:
|
10
10
|
|
11
11
|
##
|
12
12
|
# Is the attribute readable ('R'), writable ('W') or both ('RW')?
|
@@ -92,6 +92,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
92
92
|
@visibility,
|
93
93
|
parse(@comment),
|
94
94
|
singleton,
|
95
|
+
@file.absolute_name,
|
95
96
|
]
|
96
97
|
end
|
97
98
|
|
@@ -103,6 +104,7 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
103
104
|
# * #parent_name
|
104
105
|
|
105
106
|
def marshal_load array
|
107
|
+
version = array[0]
|
106
108
|
@name = array[1]
|
107
109
|
@full_name = array[2]
|
108
110
|
@rw = array[3]
|
@@ -110,9 +112,22 @@ class RDoc::Attr < RDoc::MethodAttr
|
|
110
112
|
@comment = array[5]
|
111
113
|
@singleton = array[6] || false # MARSHAL_VERSION == 0
|
112
114
|
|
115
|
+
@file = RDoc::TopLevel.new array[7] if version > 1
|
116
|
+
|
113
117
|
@parent_name = @full_name
|
114
118
|
end
|
115
119
|
|
120
|
+
def pretty_print q # :nodoc:
|
121
|
+
q.group 2, "[#{self.class.name} #{full_name} #{rw} #{visibility}", "]" do
|
122
|
+
unless comment.empty? then
|
123
|
+
q.breakable
|
124
|
+
q.text "comment:"
|
125
|
+
q.breakable
|
126
|
+
q.pp @comment
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
116
131
|
def to_s # :nodoc:
|
117
132
|
"#{definition} #{name} in: #{parent}"
|
118
133
|
end
|
data/lib/rdoc/class_module.rb
CHANGED
@@ -6,13 +6,26 @@ require 'rdoc/context'
|
|
6
6
|
|
7
7
|
class RDoc::ClassModule < RDoc::Context
|
8
8
|
|
9
|
-
|
9
|
+
##
|
10
|
+
# 1::
|
11
|
+
# RDoc 3.7
|
12
|
+
# * Added visibility, singleton and file to attributes
|
13
|
+
# * Added file to constants
|
14
|
+
# * Added file to includes
|
15
|
+
# * Added file to methods
|
16
|
+
|
17
|
+
MARSHAL_VERSION = 1 # :nodoc:
|
10
18
|
|
11
19
|
##
|
12
20
|
# Constants that are aliases for this class or module
|
13
21
|
|
14
22
|
attr_accessor :constant_aliases
|
15
23
|
|
24
|
+
##
|
25
|
+
# Comment and the location it came from. Use #add_comment to add comments
|
26
|
+
|
27
|
+
attr_reader :comment_location
|
28
|
+
|
16
29
|
attr_accessor :diagram # :nodoc:
|
17
30
|
|
18
31
|
##
|
@@ -23,10 +36,16 @@ class RDoc::ClassModule < RDoc::Context
|
|
23
36
|
##
|
24
37
|
# Return a RDoc::ClassModule of class +class_type+ that is a copy
|
25
38
|
# of module +module+. Used to promote modules to classes.
|
39
|
+
#--
|
40
|
+
# TODO move to RDoc::NormalClass (I think)
|
41
|
+
|
42
|
+
def self.from_module class_type, mod
|
43
|
+
klass = class_type.new mod.name
|
44
|
+
|
45
|
+
mod.comment_location.each do |comment, location|
|
46
|
+
klass.add_comment comment, location
|
47
|
+
end
|
26
48
|
|
27
|
-
def self.from_module(class_type, mod)
|
28
|
-
klass = class_type.new(mod.name)
|
29
|
-
klass.comment = mod.comment
|
30
49
|
klass.parent = mod.parent
|
31
50
|
klass.section = mod.section
|
32
51
|
klass.viewer = mod.viewer
|
@@ -85,9 +104,27 @@ class RDoc::ClassModule < RDoc::Context
|
|
85
104
|
@is_alias_for = nil
|
86
105
|
@name = name
|
87
106
|
@superclass = superclass
|
107
|
+
@comment_location = [] # [[comment, location]]
|
108
|
+
|
88
109
|
super()
|
89
110
|
end
|
90
111
|
|
112
|
+
##
|
113
|
+
# Adds +comment+ to this ClassModule's list of comments at +location+. This
|
114
|
+
# method is preferred over #comment= since it allows ri data to be updated
|
115
|
+
# across multiple runs.
|
116
|
+
|
117
|
+
def add_comment comment, location
|
118
|
+
return if comment.empty?
|
119
|
+
|
120
|
+
original = comment
|
121
|
+
|
122
|
+
comment = normalize_comment comment
|
123
|
+
@comment_location << [comment, location]
|
124
|
+
|
125
|
+
self.comment = original
|
126
|
+
end
|
127
|
+
|
91
128
|
##
|
92
129
|
# Ancestors list for this ClassModule: the list of included modules
|
93
130
|
# (classes will add their superclass if any).
|
@@ -112,6 +149,8 @@ class RDoc::ClassModule < RDoc::Context
|
|
112
149
|
end
|
113
150
|
|
114
151
|
##
|
152
|
+
# This method is deprecated, use #add_comment instead.
|
153
|
+
#
|
115
154
|
# Appends +comment+ to the current comment, but separated by a rule. Works
|
116
155
|
# more like <tt>+=</tt>.
|
117
156
|
|
@@ -119,10 +158,9 @@ class RDoc::ClassModule < RDoc::Context
|
|
119
158
|
return if comment.empty?
|
120
159
|
|
121
160
|
comment = normalize_comment comment
|
122
|
-
comment = "#{@comment}\n---\n#{comment}" unless
|
123
|
-
@comment.empty?
|
161
|
+
comment = "#{@comment}\n---\n#{comment}" unless @comment.empty?
|
124
162
|
|
125
|
-
super
|
163
|
+
super comment
|
126
164
|
end
|
127
165
|
|
128
166
|
##
|
@@ -185,15 +223,16 @@ class RDoc::ClassModule < RDoc::Context
|
|
185
223
|
end
|
186
224
|
|
187
225
|
def marshal_dump # :nodoc:
|
188
|
-
# TODO must store the singleton attribute
|
189
226
|
attrs = attributes.sort.map do |attr|
|
190
|
-
[attr.name, attr.rw
|
227
|
+
[ attr.name, attr.rw,
|
228
|
+
attr.visibility, attr.singleton, attr.file_name,
|
229
|
+
]
|
191
230
|
end
|
192
231
|
|
193
232
|
method_types = methods_by_type.map do |type, visibilities|
|
194
233
|
visibilities = visibilities.map do |visibility, methods|
|
195
234
|
method_names = methods.map do |method|
|
196
|
-
method.name
|
235
|
+
[method.name, method.file_name]
|
197
236
|
end
|
198
237
|
|
199
238
|
[visibility, method_names.uniq]
|
@@ -206,51 +245,67 @@ class RDoc::ClassModule < RDoc::Context
|
|
206
245
|
@name,
|
207
246
|
full_name,
|
208
247
|
@superclass,
|
209
|
-
parse(@
|
248
|
+
parse(@comment_location),
|
210
249
|
attrs,
|
211
250
|
constants.map do |const|
|
212
|
-
[const.name, parse(const.comment)]
|
251
|
+
[const.name, parse(const.comment), const.file_name]
|
213
252
|
end,
|
214
253
|
includes.map do |incl|
|
215
|
-
[incl.name, parse(incl.comment)]
|
254
|
+
[incl.name, parse(incl.comment), incl.file_name]
|
216
255
|
end,
|
217
256
|
method_types,
|
218
257
|
]
|
219
258
|
end
|
220
259
|
|
221
260
|
def marshal_load array # :nodoc:
|
222
|
-
# TODO must restore the singleton attribute
|
223
261
|
initialize_methods_etc
|
224
|
-
@
|
225
|
-
@
|
226
|
-
@
|
227
|
-
@parent
|
228
|
-
@
|
262
|
+
@current_section = nil
|
263
|
+
@document_self = true
|
264
|
+
@done_documenting = false
|
265
|
+
@parent = nil
|
266
|
+
@temporary_section = nil
|
267
|
+
@visibility = nil
|
229
268
|
|
230
269
|
@name = array[1]
|
231
270
|
@full_name = array[2]
|
232
271
|
@superclass = array[3]
|
233
272
|
@comment = array[4]
|
234
273
|
|
235
|
-
|
236
|
-
|
274
|
+
@comment_location = if RDoc::Markup::Document === @comment.parts.first then
|
275
|
+
@comment
|
276
|
+
else
|
277
|
+
RDoc::Markup::Document.new @comment
|
278
|
+
end
|
279
|
+
|
280
|
+
array[5].each do |name, rw, visibility, singleton, file|
|
281
|
+
singleton ||= false
|
282
|
+
visibility ||= :public
|
283
|
+
|
284
|
+
attr = RDoc::Attr.new nil, name, rw, nil, singleton
|
285
|
+
|
286
|
+
add_attribute attr
|
287
|
+
attr.visibility = visibility
|
288
|
+
attr.record_location RDoc::TopLevel.new file
|
237
289
|
end
|
238
290
|
|
239
|
-
array[6].each do |name, comment|
|
240
|
-
add_constant RDoc::Constant.new(name, nil, comment)
|
291
|
+
array[6].each do |name, comment, file|
|
292
|
+
const = add_constant RDoc::Constant.new(name, nil, comment)
|
293
|
+
const.record_location RDoc::TopLevel.new file
|
241
294
|
end
|
242
295
|
|
243
|
-
array[7].each do |name, comment|
|
244
|
-
add_include RDoc::Include.new(name, comment)
|
296
|
+
array[7].each do |name, comment, file|
|
297
|
+
incl = add_include RDoc::Include.new(name, comment)
|
298
|
+
incl.record_location RDoc::TopLevel.new file
|
245
299
|
end
|
246
300
|
|
247
301
|
array[8].each do |type, visibilities|
|
248
302
|
visibilities.each do |visibility, methods|
|
249
303
|
@visibility = visibility
|
250
304
|
|
251
|
-
methods.each do |name|
|
305
|
+
methods.each do |name, file|
|
252
306
|
method = RDoc::AnyMethod.new nil, name
|
253
307
|
method.singleton = true if type == 'class'
|
308
|
+
method.record_location RDoc::TopLevel.new file
|
254
309
|
add_method method
|
255
310
|
end
|
256
311
|
end
|
@@ -258,37 +313,73 @@ class RDoc::ClassModule < RDoc::Context
|
|
258
313
|
end
|
259
314
|
|
260
315
|
##
|
261
|
-
# Merges +class_module+ into this ClassModule
|
316
|
+
# Merges +class_module+ into this ClassModule.
|
317
|
+
#
|
318
|
+
# The data in +class_module+ is preferred over the receiver.
|
262
319
|
|
263
320
|
def merge class_module
|
264
|
-
|
321
|
+
other_document = parse class_module.comment_location
|
265
322
|
|
266
|
-
if
|
267
|
-
document = parse @
|
323
|
+
if other_document then
|
324
|
+
document = parse @comment_location
|
268
325
|
|
269
|
-
|
326
|
+
document = document.merge other_document
|
270
327
|
|
271
|
-
@comment =
|
328
|
+
@comment = @comment_location = document
|
272
329
|
end
|
273
330
|
|
274
|
-
class_module.
|
275
|
-
if
|
276
|
-
match.rw = [match.rw, attr.rw].compact.uniq.join
|
277
|
-
else
|
331
|
+
merge_collections attributes, class_module.attributes do |add, attr|
|
332
|
+
if add then
|
278
333
|
add_attribute attr
|
334
|
+
else
|
335
|
+
@attributes.delete attr
|
336
|
+
@methods_hash.delete attr.pretty_name
|
279
337
|
end
|
280
338
|
end
|
281
339
|
|
282
|
-
class_module.
|
283
|
-
|
340
|
+
merge_collections constants, class_module.constants do |add, const|
|
341
|
+
if add then
|
342
|
+
add_constant const
|
343
|
+
else
|
344
|
+
@constants.delete const
|
345
|
+
@constants_hash.delete const.name
|
346
|
+
end
|
284
347
|
end
|
285
348
|
|
286
|
-
class_module.
|
287
|
-
|
349
|
+
merge_collections includes, class_module.includes do |add, incl|
|
350
|
+
if add then
|
351
|
+
add_include incl
|
352
|
+
else
|
353
|
+
@includes.delete incl
|
354
|
+
end
|
288
355
|
end
|
289
356
|
|
290
|
-
class_module.
|
291
|
-
|
357
|
+
merge_collections method_list, class_module.method_list do |add, meth|
|
358
|
+
if add then
|
359
|
+
add_method meth
|
360
|
+
else
|
361
|
+
@method_list.delete meth
|
362
|
+
@methods_hash.delete meth.pretty_name
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
self
|
367
|
+
end
|
368
|
+
|
369
|
+
##
|
370
|
+
# Merges collection +mine+ with +other+ preferring other.
|
371
|
+
|
372
|
+
def merge_collections mine, other, &block # :nodoc:
|
373
|
+
my_things = mine. group_by { |thing| thing.file }
|
374
|
+
other_things = other.group_by { |thing| thing.file }
|
375
|
+
|
376
|
+
other_things.each do |file, things|
|
377
|
+
my_things[file].each { |thing| yield false, thing } if
|
378
|
+
my_things.include? file
|
379
|
+
|
380
|
+
things.each do |thing|
|
381
|
+
yield true, thing
|
382
|
+
end
|
292
383
|
end
|
293
384
|
end
|
294
385
|
|
@@ -308,6 +399,29 @@ class RDoc::ClassModule < RDoc::Context
|
|
308
399
|
@name = new_name
|
309
400
|
end
|
310
401
|
|
402
|
+
##
|
403
|
+
# Parses +comment_location+ into an RDoc::Markup::Document composed of
|
404
|
+
# multiple RDoc::Markup::Documents with their file set.
|
405
|
+
|
406
|
+
def parse comment_location
|
407
|
+
case comment_location
|
408
|
+
when String then
|
409
|
+
super
|
410
|
+
when Array then
|
411
|
+
docs = comment_location.map do |comment, location|
|
412
|
+
doc = super comment
|
413
|
+
doc.file = location.absolute_name
|
414
|
+
doc
|
415
|
+
end
|
416
|
+
|
417
|
+
RDoc::Markup::Document.new(*docs)
|
418
|
+
when RDoc::Markup::Document then
|
419
|
+
return comment_location
|
420
|
+
else
|
421
|
+
raise ArgumentError, "unknown comment class #{comment_location.class}"
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
311
425
|
##
|
312
426
|
# Path to this class or module
|
313
427
|
|