Sha256: a9f60d96ba133c07f1dcb9d6c03b7759080a5523b0b03c1034f34234c191631d
Contents?: true
Size: 431 Bytes
Versions: 13
Compression:
Stored size: 431 Bytes
Contents
# copied from http://snippets.dzone.com/posts/show/2992 class Object def self.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
Version data entries
13 entries across 13 versions & 1 rubygems