aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/code_object.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/code_object.rb')
-rw-r--r--lib/rdoc/code_object.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rdoc/code_object.rb b/lib/rdoc/code_object.rb
index 3a8adfab67..63f86afc64 100644
--- a/lib/rdoc/code_object.rb
+++ b/lib/rdoc/code_object.rb
@@ -181,6 +181,20 @@ class RDoc::CodeObject
end
##
+ # Yields each parent of this CodeObject. See also
+ # RDoc::ClassModule#each_ancestor
+
+ def each_parent
+ code_object = self
+
+ while code_object = code_object.parent do
+ yield code_object
+ end
+
+ self
+ end
+
+ ##
# Force the documentation of this object unless documentation
# has been turned off by :endoc:
#--