0

Count and instances

In Ruby, can anyone recommend a better way to count instances and track details of all instances? What I typically do is define class variables @@count = 0 and @@instances = [] and use @@count += 1 and @@instances << self under initialize. Thanks!

26th Dec 2017, 6:06 AM
Ken Kelley
Ken Kelley - avatar
1 Answer