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/lib/rdoc/code_object.rb
CHANGED
@@ -130,7 +130,8 @@ class RDoc::CodeObject
|
|
130
130
|
# TODO is this sufficient?
|
131
131
|
# HACK correct fix is to have #initialize create @comment
|
132
132
|
# with the correct encoding
|
133
|
-
if
|
133
|
+
if String === @comment and
|
134
|
+
Object.const_defined? :Encoding and @comment.empty? then
|
134
135
|
@comment.force_encoding comment.encoding
|
135
136
|
end
|
136
137
|
@comment
|
@@ -194,6 +195,12 @@ class RDoc::CodeObject
|
|
194
195
|
self
|
195
196
|
end
|
196
197
|
|
198
|
+
def file_name
|
199
|
+
return unless @file
|
200
|
+
|
201
|
+
@file.absolute_name
|
202
|
+
end
|
203
|
+
|
197
204
|
##
|
198
205
|
# Force the documentation of this object unless documentation
|
199
206
|
# has been turned off by :endoc:
|
data/lib/rdoc/context.rb
CHANGED
@@ -30,9 +30,9 @@ class RDoc::Context < RDoc::CodeObject
|
|
30
30
|
attr_reader :constants
|
31
31
|
|
32
32
|
##
|
33
|
-
#
|
33
|
+
# Sets the current documentation section of documentation
|
34
34
|
|
35
|
-
|
35
|
+
attr_writer :current_section
|
36
36
|
|
37
37
|
##
|
38
38
|
# Files this context is found in
|
@@ -59,6 +59,11 @@ class RDoc::Context < RDoc::CodeObject
|
|
59
59
|
|
60
60
|
attr_reader :requires
|
61
61
|
|
62
|
+
##
|
63
|
+
# Use this section for the next method, attribute or constant added.
|
64
|
+
|
65
|
+
attr_accessor :temporary_section
|
66
|
+
|
62
67
|
##
|
63
68
|
# Hash <tt>old_name => [aliases]</tt>, for aliases
|
64
69
|
# that haven't (yet) been resolved to a method/attribute.
|
@@ -186,10 +191,7 @@ class RDoc::Context < RDoc::CodeObject
|
|
186
191
|
end
|
187
192
|
|
188
193
|
def inspect # :nodoc:
|
189
|
-
"#<%s:0x%x %
|
190
|
-
self.class, object_id,
|
191
|
-
@sequence, title
|
192
|
-
]
|
194
|
+
"#<%s:0x%x %p>" % [self.class, object_id, title]
|
193
195
|
end
|
194
196
|
|
195
197
|
##
|
@@ -216,6 +218,7 @@ class RDoc::Context < RDoc::CodeObject
|
|
216
218
|
|
217
219
|
@current_section = Section.new self, nil, nil
|
218
220
|
@sections = { nil => @current_section }
|
221
|
+
@temporary_section = nil
|
219
222
|
|
220
223
|
@classes = {}
|
221
224
|
@modules = {}
|
@@ -287,22 +290,32 @@ class RDoc::Context < RDoc::CodeObject
|
|
287
290
|
# TODO find a policy for 'attr_reader :foo' + 'def foo=()'
|
288
291
|
register = false
|
289
292
|
|
290
|
-
|
293
|
+
key = nil
|
294
|
+
|
295
|
+
if attribute.rw.index 'R' then
|
291
296
|
key = attribute.pretty_name
|
292
297
|
known = @methods_hash[key]
|
298
|
+
|
293
299
|
if known then
|
294
300
|
known.comment = attribute.comment if known.comment.empty?
|
301
|
+
elsif registered = @methods_hash[attribute.pretty_name << '='] and
|
302
|
+
RDoc::Attr === registered then
|
303
|
+
registered.rw = 'RW'
|
295
304
|
else
|
296
305
|
@methods_hash[key] = attribute
|
297
306
|
register = true
|
298
307
|
end
|
299
308
|
end
|
300
309
|
|
301
|
-
if attribute.rw.index
|
310
|
+
if attribute.rw.index 'W' then
|
302
311
|
key = attribute.pretty_name << '='
|
303
312
|
known = @methods_hash[key]
|
313
|
+
|
304
314
|
if known then
|
305
315
|
known.comment = attribute.comment if known.comment.empty?
|
316
|
+
elsif registered = @methods_hash[attribute.pretty_name] and
|
317
|
+
RDoc::Attr === registered then
|
318
|
+
registered.rw = 'RW'
|
306
319
|
else
|
307
320
|
@methods_hash[key] = attribute
|
308
321
|
register = true
|
@@ -314,6 +327,8 @@ class RDoc::Context < RDoc::CodeObject
|
|
314
327
|
add_to @attributes, attribute
|
315
328
|
resolve_aliases attribute
|
316
329
|
end
|
330
|
+
|
331
|
+
attribute
|
317
332
|
end
|
318
333
|
|
319
334
|
##
|
@@ -444,8 +459,8 @@ class RDoc::Context < RDoc::CodeObject
|
|
444
459
|
# to +self+, and its #section to #current_section. Returns +mod+.
|
445
460
|
|
446
461
|
def add_class_or_module mod, self_hash, all_hash
|
447
|
-
mod.section =
|
448
|
-
|
462
|
+
mod.section = current_section # TODO declaring context? something is
|
463
|
+
# wrong here...
|
449
464
|
mod.parent = self
|
450
465
|
|
451
466
|
unless @done_documenting then
|
@@ -462,7 +477,7 @@ class RDoc::Context < RDoc::CodeObject
|
|
462
477
|
# Adds +constant+ if not already there. If it is, updates the comment,
|
463
478
|
# value and/or is_alias_for of the known constant if they were empty/nil.
|
464
479
|
|
465
|
-
def add_constant
|
480
|
+
def add_constant constant
|
466
481
|
return constant unless @document_self
|
467
482
|
|
468
483
|
# HACK: avoid duplicate 'PI' & 'E' in math.c (1.8.7 source code)
|
@@ -480,28 +495,32 @@ class RDoc::Context < RDoc::CodeObject
|
|
480
495
|
@constants_hash[constant.name] = constant
|
481
496
|
add_to @constants, constant
|
482
497
|
end
|
498
|
+
|
499
|
+
constant
|
483
500
|
end
|
484
501
|
|
485
502
|
##
|
486
503
|
# Adds included module +include+ which should be an RDoc::Include
|
487
504
|
|
488
|
-
def add_include
|
489
|
-
add_to @includes, include unless
|
505
|
+
def add_include include
|
506
|
+
add_to @includes, include unless
|
507
|
+
@includes.map { |i| i.full_name }.include? include.full_name
|
508
|
+
|
509
|
+
include
|
490
510
|
end
|
491
511
|
|
492
512
|
##
|
493
513
|
# Adds +method+ if not already there. If it is (as method or attribute),
|
494
514
|
# updates the comment if it was empty.
|
495
515
|
|
496
|
-
def add_method
|
516
|
+
def add_method method
|
497
517
|
return method unless @document_self
|
498
518
|
|
499
519
|
# HACK: avoid duplicate 'new' in io.c & struct.c (1.8.7 source code)
|
500
520
|
key = method.pretty_name
|
501
521
|
known = @methods_hash[key]
|
502
|
-
|
503
|
-
|
504
|
-
#$stderr.puts "\n#{display(method)} already registered as #{display(known)}"
|
522
|
+
|
523
|
+
if known then
|
505
524
|
known.comment = method.comment if known.comment.empty?
|
506
525
|
else
|
507
526
|
@methods_hash[key] = method
|
@@ -509,6 +528,8 @@ class RDoc::Context < RDoc::CodeObject
|
|
509
528
|
add_to @method_list, method
|
510
529
|
resolve_aliases method
|
511
530
|
end
|
531
|
+
|
532
|
+
method
|
512
533
|
end
|
513
534
|
|
514
535
|
##
|
@@ -572,13 +593,32 @@ class RDoc::Context < RDoc::CodeObject
|
|
572
593
|
end
|
573
594
|
end
|
574
595
|
|
596
|
+
##
|
597
|
+
# Returns a section with +title+, creating it if it doesn't already exist.
|
598
|
+
# +comment+ will be appended to the section's comment.
|
599
|
+
#
|
600
|
+
# A section with a +title+ of +nil+ will return the default section.
|
601
|
+
#
|
602
|
+
# See also RDoc::Context::Section
|
603
|
+
|
604
|
+
def add_section title, comment
|
605
|
+
if section = @sections[title] then
|
606
|
+
section.comment = comment
|
607
|
+
else
|
608
|
+
section = Section.new self, title, comment
|
609
|
+
@sections[title] = section
|
610
|
+
end
|
611
|
+
|
612
|
+
section
|
613
|
+
end
|
614
|
+
|
575
615
|
##
|
576
616
|
# Adds +thing+ to the collection +array+
|
577
617
|
|
578
618
|
def add_to(array, thing)
|
579
619
|
array << thing if @document_self
|
580
620
|
thing.parent = self
|
581
|
-
thing.section =
|
621
|
+
thing.section = current_section
|
582
622
|
end
|
583
623
|
|
584
624
|
##
|
@@ -648,6 +688,20 @@ class RDoc::Context < RDoc::CodeObject
|
|
648
688
|
@classes
|
649
689
|
end
|
650
690
|
|
691
|
+
##
|
692
|
+
# The current documentation section that new items will be added to. If
|
693
|
+
# temporary_section is available it will be used.
|
694
|
+
|
695
|
+
def current_section
|
696
|
+
if section = @temporary_section then
|
697
|
+
@temporary_section = nil
|
698
|
+
else
|
699
|
+
section = @current_section
|
700
|
+
end
|
701
|
+
|
702
|
+
section
|
703
|
+
end
|
704
|
+
|
651
705
|
##
|
652
706
|
# Is part of this thing was defined in +file+?
|
653
707
|
|
@@ -1082,18 +1136,10 @@ class RDoc::Context < RDoc::CodeObject
|
|
1082
1136
|
end
|
1083
1137
|
|
1084
1138
|
##
|
1085
|
-
#
|
1086
|
-
|
1087
|
-
def set_current_section(title, comment)
|
1088
|
-
if @sections.key? title then
|
1089
|
-
@current_section = @sections[title]
|
1090
|
-
@current_section.comment = comment
|
1091
|
-
else
|
1092
|
-
@current_section = Section.new self, title, comment
|
1093
|
-
@sections[title] = @current_section
|
1094
|
-
end
|
1139
|
+
# Sets the current section to a section with +title+. See also #add_section
|
1095
1140
|
|
1096
|
-
|
1141
|
+
def set_current_section title, comment
|
1142
|
+
@current_section = add_section title, comment
|
1097
1143
|
end
|
1098
1144
|
|
1099
1145
|
##
|
@@ -42,7 +42,9 @@ module RDoc::Generator::Markup
|
|
42
42
|
show_hash = RDoc::RDoc.current.options.show_hash
|
43
43
|
hyperlink_all = RDoc::RDoc.current.options.hyperlink_all
|
44
44
|
this = RDoc::Context === self ? self : @parent
|
45
|
-
|
45
|
+
|
46
|
+
@formatter = RDoc::Markup::ToHtmlCrossref.new(this.path, this, show_hash,
|
47
|
+
hyperlink_all)
|
46
48
|
end
|
47
49
|
|
48
50
|
##
|
data/lib/rdoc/generator/ri.rb
CHANGED
@@ -18,11 +18,12 @@ class RDoc::Generator::RI
|
|
18
18
|
|
19
19
|
def initialize options #:not-new:
|
20
20
|
@options = options
|
21
|
-
@store = RDoc::RI::Store.new '.'
|
22
21
|
@old_siginfo = nil
|
23
22
|
@current = nil
|
24
23
|
|
25
|
-
@store
|
24
|
+
@store = RDoc::RI::Store.new '.'
|
25
|
+
@store.dry_run = @options.dry_run
|
26
|
+
@store.encoding = @options.encoding if @options.respond_to? :encoding
|
26
27
|
end
|
27
28
|
|
28
29
|
##
|
data/lib/rdoc/known_classes.rb
CHANGED
@@ -36,7 +36,7 @@ module RDoc
|
|
36
36
|
"rb_eArgError" => "ArgError",
|
37
37
|
"rb_eEOFError" => "EOFError",
|
38
38
|
"rb_eException" => "Exception",
|
39
|
-
"rb_eFatal" => "
|
39
|
+
"rb_eFatal" => "fatal",
|
40
40
|
"rb_eFloatDomainError" => "FloatDomainError",
|
41
41
|
"rb_eIOError" => "IOError",
|
42
42
|
"rb_eIndexError" => "IndexError",
|
@@ -49,7 +49,7 @@ module RDoc
|
|
49
49
|
"rb_eRuntimeError" => "RuntimeError",
|
50
50
|
"rb_eScriptError" => "ScriptError",
|
51
51
|
"rb_eSecurityError" => "SecurityError",
|
52
|
-
"rb_eSignal" => "
|
52
|
+
"rb_eSignal" => "SignalException",
|
53
53
|
"rb_eStandardError" => "StandardError",
|
54
54
|
"rb_eSyntaxError" => "SyntaxError",
|
55
55
|
"rb_eSystemCallError" => "SystemCallError",
|
data/lib/rdoc/markup.rb
CHANGED
@@ -48,13 +48,13 @@ require 'rdoc'
|
|
48
48
|
# end
|
49
49
|
# end
|
50
50
|
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
51
|
+
# markup = RDoc::Markup.new
|
52
|
+
# markup.add_word_pair("{", "}", :STRIKE)
|
53
|
+
# markup.add_html("no", :STRIKE)
|
54
54
|
#
|
55
|
-
#
|
55
|
+
# markup.add_special(/\b([A-Z][a-z]+[A-Z]\w+)/, :WIKIWORD)
|
56
56
|
#
|
57
|
-
# wh = WikiHtml.new
|
57
|
+
# wh = WikiHtml.new markup
|
58
58
|
# wh.add_tag(:STRIKE, "<strike>", "</strike>")
|
59
59
|
#
|
60
60
|
# puts "<body>#{wh.convert ARGF.read}</body>"
|
@@ -498,15 +498,53 @@ require 'rdoc'
|
|
498
498
|
# [+:main:+ _name_]
|
499
499
|
# Equivalent to the <tt>--main</tt> command line parameter.
|
500
500
|
#
|
501
|
+
# [<tt>:category: section</tt>]
|
502
|
+
# Adds this item to the named +section+ overriding the current section. Use
|
503
|
+
# this to group methods by section in RDoc output while maintaining a
|
504
|
+
# sensible ordering (like alphabetical).
|
505
|
+
#
|
506
|
+
# # :category: Utility Methods
|
507
|
+
# #
|
508
|
+
# # CGI escapes +text+
|
509
|
+
#
|
510
|
+
# def convert_string text
|
511
|
+
# CGI.escapeHTML text
|
512
|
+
# end
|
513
|
+
#
|
514
|
+
# An empty category will place the item in the default category:
|
515
|
+
#
|
516
|
+
# # :category:
|
517
|
+
# #
|
518
|
+
# # This method is in the default category
|
519
|
+
#
|
520
|
+
# def some_method
|
521
|
+
# # ...
|
522
|
+
# end
|
523
|
+
#
|
524
|
+
# Unlike the :section: directive, :category: is not sticky. The category
|
525
|
+
# only applies to the item immediately following the comment.
|
526
|
+
#
|
527
|
+
# Use the :section: directive to provide introductory text for a section of
|
528
|
+
# documentation.
|
529
|
+
#
|
501
530
|
# [<tt>:section: title</tt>]
|
502
|
-
#
|
503
|
-
# used as the section
|
504
|
-
# the section is used as introductory text.
|
505
|
-
#
|
531
|
+
# Provides section introductory text in RDoc output. The title following
|
532
|
+
# +:section:+ is used as the section name and the remainder of the comment
|
533
|
+
# containing the section is used as introductory text. A section's comment
|
534
|
+
# block must be separated from following comment blocks. Use an empty title
|
535
|
+
# to switch to the default section.
|
536
|
+
#
|
537
|
+
# The :section: directive is sticky, so subsequent methods, aliases,
|
538
|
+
# attributes, and classes will be contained in this section until the
|
539
|
+
# section is changed. The :category: directive will override the :section:
|
540
|
+
# directive.
|
506
541
|
#
|
507
542
|
# A :section: comment block may have one or more lines before the :section:
|
508
543
|
# directive. These will be removed, and any identical lines at the end of
|
509
|
-
# the block are also removed. This allows you to add visual cues
|
544
|
+
# the block are also removed. This allows you to add visual cues to the
|
545
|
+
# section.
|
546
|
+
#
|
547
|
+
# Example:
|
510
548
|
#
|
511
549
|
# # ----------------------------------------
|
512
550
|
# # :section: My Section
|
@@ -514,10 +552,12 @@ require 'rdoc'
|
|
514
552
|
# # See it glisten in the noon-day sun.
|
515
553
|
# # ----------------------------------------
|
516
554
|
#
|
517
|
-
#
|
518
|
-
#
|
519
|
-
#
|
520
|
-
#
|
555
|
+
# ##
|
556
|
+
# # Comment for some_method
|
557
|
+
#
|
558
|
+
# def some_method
|
559
|
+
# # ...
|
560
|
+
# end
|
521
561
|
#
|
522
562
|
# [+:call-seq:+]
|
523
563
|
# Lines up to the next blank line in the comment are treated as the method's
|
@@ -576,11 +616,16 @@ class RDoc::Markup
|
|
576
616
|
end
|
577
617
|
|
578
618
|
##
|
579
|
-
# We take +
|
580
|
-
# Visitor to render the result.
|
619
|
+
# We take +input+, parse it if necessary, then invoke the output +formatter+
|
620
|
+
# using a Visitor to render the result.
|
581
621
|
|
582
|
-
def convert
|
583
|
-
document =
|
622
|
+
def convert input, formatter
|
623
|
+
document = case input
|
624
|
+
when RDoc::Markup::Document then
|
625
|
+
input
|
626
|
+
else
|
627
|
+
RDoc::Markup::Parser.parse input
|
628
|
+
end
|
584
629
|
|
585
630
|
document.accept formatter
|
586
631
|
end
|
data/lib/rdoc/markup/document.rb
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
|
4
4
|
class RDoc::Markup::Document
|
5
5
|
|
6
|
+
##
|
7
|
+
# The file this document was created from. See also
|
8
|
+
# RDoc::ClassModule#add_comment
|
9
|
+
|
10
|
+
attr_accessor :file
|
11
|
+
|
6
12
|
##
|
7
13
|
# The parts of the Document
|
8
14
|
|
@@ -14,6 +20,8 @@ class RDoc::Markup::Document
|
|
14
20
|
def initialize *parts
|
15
21
|
@parts = []
|
16
22
|
@parts.push(*parts)
|
23
|
+
|
24
|
+
@file = nil
|
17
25
|
end
|
18
26
|
|
19
27
|
##
|
@@ -36,7 +44,9 @@ class RDoc::Markup::Document
|
|
36
44
|
end
|
37
45
|
|
38
46
|
def == other # :nodoc:
|
39
|
-
self.class == other.class and
|
47
|
+
self.class == other.class and
|
48
|
+
@file == other.file and
|
49
|
+
@parts == other.parts
|
40
50
|
end
|
41
51
|
|
42
52
|
##
|
@@ -46,7 +56,12 @@ class RDoc::Markup::Document
|
|
46
56
|
visitor.start_accepting
|
47
57
|
|
48
58
|
@parts.each do |item|
|
49
|
-
item
|
59
|
+
case item
|
60
|
+
when RDoc::Markup::Document then # HACK
|
61
|
+
visitor.accept_document item
|
62
|
+
else
|
63
|
+
item.accept visitor
|
64
|
+
end
|
50
65
|
end
|
51
66
|
|
52
67
|
visitor.end_accepting
|
@@ -56,11 +71,35 @@ class RDoc::Markup::Document
|
|
56
71
|
# Does this document have no parts?
|
57
72
|
|
58
73
|
def empty?
|
59
|
-
@parts.empty?
|
74
|
+
@parts.empty? or
|
75
|
+
(@parts.length == 1 and RDoc::Markup::Document === @parts.first and
|
76
|
+
@parts.first.empty?)
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# When this is a collection of documents (#file is not set and this document
|
81
|
+
# contains only other documents as its direct children) #merge replaces
|
82
|
+
# documents in this class with documents from +other+ when the file matches
|
83
|
+
# and adds documents from +other+ when the files do not.
|
84
|
+
#
|
85
|
+
# The information in +other+ is preferred over the receiver
|
86
|
+
|
87
|
+
def merge other
|
88
|
+
other.parts.each do |other_part|
|
89
|
+
self.parts.delete_if do |self_part|
|
90
|
+
self_part.file and self_part.file == other_part.file
|
91
|
+
end
|
92
|
+
|
93
|
+
self.parts << other_part
|
94
|
+
end
|
95
|
+
|
96
|
+
self
|
60
97
|
end
|
61
98
|
|
62
99
|
def pretty_print q # :nodoc:
|
63
|
-
|
100
|
+
start = @file ? "[doc (#{@file}): " : '[doc: '
|
101
|
+
|
102
|
+
q.group 2, start, ']' do
|
64
103
|
q.seplist @parts do |part|
|
65
104
|
q.pp part
|
66
105
|
end
|