Method: Class#instances
- Defined in:
- lib/extra/class.rb
#instances ⇒ Object
Get all instances of this class that exist in ObjectSpace.
Example: Module.instances #=> [Marshal, ObjectSpace, GC, Math, ...]
Returns: Array
8 9 10 |
# File 'lib/extra/class.rb', line 8 def instances objects = []; ObjectSpace.each_object(self) { |obj| objects << obj }; objects end |