Created
August 29, 2008 20:58
-
-
Save atduskgreg/8055 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 subclasses_of klass | |
result = [] | |
ObjectSpace.each_object(Class) do |o| | |
result << o if o.ancestors.include? klass | |
end | |
result.reject{|i| i == klass} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment