Actions
Feature #9779
openAdd Module#descendents
    Feature #9779:
    Add Module#descendents
  
Status:
Open
Assignee:
-
Target version:
-
Description
Now classes have links to their subclasses, so how about to add Module#descendents?
class X
end
class Y < X
end
class Z < Y
end
p X.descendents    #=> [X, Y, Z]
module A
end
module B
  include A
end
module C
  include A
end
p A.descendents    #=> [A, C, B]
One of my own use cases is to implement AspectJ like pointcut which matches all subclasses of the given class.
Considerations:
- Should the return value of Module#descendents include self?
 - Should the return value of Module#descendents include singleton classes?
 
I attach a patch, where the return value includes both self and singleton classes.
Files
        
          
          Updated by shugo (Shugo Maeda) over 11 years ago
          
          
        
        
      
      s/descendents/descendants/
        
          
          Updated by naruse (Yui NARUSE) almost 8 years ago
          
          
        
        
      
      - Target version deleted (
2.2.0) 
        
          
          Updated by jeremyevans0 (Jeremy Evans) about 4 years ago
          
          
        
        
      
      - Related to Feature #14394: Class.descendants added
 
Actions