Issue #2065 has been updated by mame (Yusuke Endoh).

Status changed from Feedback to Rejected

Hello,

I'm not keen to import this feature.

I'm closing the ticket.  Please reopen it if you find a piece of
code in the wild whose bottleneck is solved by #each_ancestor.

-- 
Yusuke Endoh <mame / tsg.ne.jp>
----------------------------------------
Feature #2065: An ancestors iterator
https://bugs.ruby-lang.org/issues/2065#change-25007

Author: bahuvrihi (Simon Chiang)
Status: Rejected
Priority: Low
Assignee: mame (Yusuke Endoh)
Category: core
Target version: 2.0.0


=begin
 I have implemented DSLs that add features to a class/module that should be inherited like methods.  In those cases I end up iterating ancestors to find the first time a feature has been added (the same way I imagine methods are determined).
 
 The issue is that SomeClass.ancestors regenerates the ancestors array each time it is called.  Therefore this is relatively slow:
 
   SomeClass.ancestors.each do |ancestor|
     # ...
   end
 
 It would be nice if there were a method that iterates ancestors without generating the ancestors array:
 
   SomeClass.each_ancestor do |ancestor|
     # ...
   end
 
 This could improve the performance of DSLs that want to support method-like inheritance.
=end



-- 
http://bugs.ruby-lang.org/