Created
July 11, 2012 09:23
-
-
Save dmajda/3089258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_classes | |
# Get list of all subclasses of Scanny::Checks::Check. | |
classes = [] | |
ObjectSpace.each_object(Class) do |klass| | |
classes << klass if klass < Scanny::Checks::Check | |
end | |
# Filter out classes that are a superclass of some other class in the list. | |
# This way only "leaf" classes remain. | |
classes.reject do |klass| | |
classes.any? { |c| c < klass } | |
end | |
classes.map(&:new) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment