Skip to content

Instantly share code, notes, and snippets.

@ZhangHanDong
Forked from jcoglan/Module_subclasses.rb
Created July 31, 2013 02:10
Show Gist options
  • Save ZhangHanDong/6118783 to your computer and use it in GitHub Desktop.
Save ZhangHanDong/6118783 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