How do I iterate over all created yet unsaved objects of a particular class with Ruby? -
i want create multiple instances of class without saving them database. want loop through objects i've created. thoughts?
sounds you're looking objectspace.each_object:
objectspace.each_object(yourclass) |o| # interesting object 'o' here end if can manually keep track of objects think better, tend see objectspace last resort.
Comments
Post a Comment