I have a script that iterates using ObjectSpace#each_object with no args. Then it prints how many instances exist for each class.
ObjectSpace#each_object
I realized that some
If you can upgrade to Ruby 2.0, you don't need to implement anything at all:
>> Kernel.instance_method(:class).bind(BasicObject.new).call => BasicObject