Skip to content

Instantly share code, notes, and snippets.

@boopathi
Forked from jcoglan/Module_subclasses.rb
Created July 12, 2012 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boopathi/3099956 to your computer and use it in GitHub Desktop.
Save boopathi/3099956 to your computer and use it in GitHub Desktop.
class Module
def subclasses
classes = []
ObjectSpace.each_object do |klass|
next unless Module === klass
classes << klass if self > klass
end
classes
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment