I just started learning Ruby today and learned to create a class and create objects that belong to that class. I'd like to know if there is a way to retrieve all of the names of the instances I've created in said class. Ex)
class Clothes
attr_accessor:color
end
shirt=Clothes.new
#=> #<Clothes:0x007f89208cd330>
pants=Clothes.new
#=> #<Clothes:0x007f89208c18f0>
socks=Clothes.new
#=> #<Clothes:0x007f8920861748>
Is there a command that will list all the object belonging to class Clothes (shirt,pants,socks) by the names I've given them? Thanks!