Skip to content

Instantly share code, notes, and snippets.

@endeepak
Created September 27, 2010 19:15
Show Gist options
  • Save endeepak/599629 to your computer and use it in GitHub Desktop.
Save endeepak/599629 to your computer and use it in GitHub Desktop.
ruby_subclasses.rb
class Class
def subclasses
result = []
ObjectSpace.each_object(Class) { |klass| result << klass if klass < self }
result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment