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 2 ms with coderay