Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Forked from jcoglan/Module_subclasses.rb
Created July 10, 2013 18:40
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 pmarreck/5968934 to your computer and use it in GitHub Desktop.
Save pmarreck/5968934 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