aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/markup/document.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/markup/document.rb')
-rw-r--r--lib/rdoc/markup/document.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/rdoc/markup/document.rb b/lib/rdoc/markup/document.rb
index 6fbef33ae3..7077f357d3 100644
--- a/lib/rdoc/markup/document.rb
+++ b/lib/rdoc/markup/document.rb
@@ -71,9 +71,7 @@ class RDoc::Markup::Document
# Does this document have no parts?
def empty?
- @parts.empty? or
- (@parts.length == 1 and RDoc::Markup::Document === @parts.first and
- @parts.first.empty?)
+ @parts.empty? or (@parts.length == 1 and merged? and @parts.first.empty?)
end
##
@@ -85,6 +83,11 @@ class RDoc::Markup::Document
# The information in +other+ is preferred over the receiver
def merge other
+ if empty? then
+ @parts = other.parts
+ return self
+ end
+
other.parts.each do |other_part|
self.parts.delete_if do |self_part|
self_part.file and self_part.file == other_part.file
@@ -96,6 +99,13 @@ class RDoc::Markup::Document
self
end
+ ##
+ # Does this Document contain other Documents?
+
+ def merged?
+ RDoc::Markup::Document === @parts.first
+ end
+
def pretty_print q # :nodoc:
start = @file ? "[doc (#{@file}): " : '[doc: '