Ruby All Subclasses

Ruby code posted
created at 09 Aug 22:47

Edit | Back
1
2
3
4
5
6
7
8
require 'set'
class Object
  @@subclasses = Set.new
  def self.inherited(klass)
      @@subclasses << klass
      puts "Class found: #{klass}.  Total: #{@@subclasses.size}"
  end
end
189 Bytes in 4 ms with coderay