Module: InheritanceTracker
- Included in:
- BuildAction
- Defined in:
- lib/kwala/extensions.rb
Overview
Provides a method that gives instances of all of the includer’s subclasses.
Instance Method Summary collapse
-
#get_implementors ⇒ Object
Returns all subclasses of calling Class.
Instance Method Details
#get_implementors ⇒ Object
Returns all subclasses of calling Class.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/kwala/extensions.rb', line 5 def get_implementors imps = [] ObjectSpace.each_object(Class) do |klass| if klass.ancestors.include?(self) imps << klass end end # remove self from the list imps - [self] end |