From: Julien Thewys Date: 2008-07-23T17:01:06+09:00 Subject: Re: simple module for "count my instances" behaviour James Coglan wrote: > I think what you really want is an instance variable in the including > class, > since the counter is a property of the class. The instance variable must > be > created anew in every including class, whereas I think your code will > try to > reuse Countable's @@counter variable for all classes. This code works: Thanks James. I was trying to illustrate the use of class variables with modules but, as you pointed out, my example is precisely a case where we need class instance variables (http://www.martinfowler.com/bliki/ClassInstanceVariable.html). -- Posted via http://www.ruby-forum.com/.