Sha256: 4dd11164063c7d3e4797cadbf4a5912b4b7b51f6f68f1a0a8e6d02327ed5abe1
Contents?: true
Size: 563 Bytes
Versions: 6
Compression:
Stored size: 563 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
6 entries across 6 versions & 1 rubygems