lib/rbs/annotate/formatter.rb in rbs-3.2.2 vs lib/rbs/annotate/formatter.rb in rbs-3.3.0.pre.1
- old
+ new
@@ -57,13 +57,23 @@
end
end
def self.each_part(doc, &block)
if block
- if doc.file
- yield doc
+ document =
+ case doc
+ when String
+ raise
+ when RDoc::Comment
+ document = doc.parse
+ when RDoc::Markup::Document
+ document = doc
+ end
+
+ if document.file
+ yield document
else
- doc.each do |d|
+ document.each do |d|
each_part(d, &block)
end
end
else
enum_for :each_part, doc