Is there a way to get all the objects that are of a certain class in Ruby?
To clarify:
class Pokemon end pikatchu = Pokemon.new charmander = Pokemon
The solution is to use ObjectSpace.each_object method like
ObjectSpace.each_object
ObjectSpace.each_object(Pokemon) {|x| p x}
which produces
=> 2
Details are discussed in the PickAxe book Chapter 25