Method: BBLib::FamilyTree#instances

Defined in:
lib/bblib/core/mixins/family_tree.rb

#instances(descendants = true) ⇒ Object

Return all live instances of the class Passing false will not include instances of sub classes



27
28
29
30
# File 'lib/bblib/core/mixins/family_tree.rb', line 27

def instances(descendants = true)
  inst = ObjectSpace.each_object(self).to_a
  descendants ? inst : inst.select { |i| i.class == self }
end