Sha256: 0d63df1e65c89ef322243b2a9383a04b50fd1812943062ea0a096fcdde89b011
Contents?: true
Size: 561 Bytes
Versions: 31
Compression:
Stored size: 561 Bytes
Contents
# From: http://snippets.dzone.com/posts/show/2992 module VirtualBox::SubclassListing def self.included(base) base.extend ClassMethods end module ClassMethods def subclasses(direct = false) classes = [] if direct ObjectSpace.each_object(Class) do |c| next unless c.superclass == self classes << c end else ObjectSpace.each_object(Class) do |c| next unless c.ancestors.include?(self) and (c != self) classes << c end end classes end end end
Version data entries
31 entries across 31 versions & 3 rubygems