From: Brian Candler Date: 2011-08-25T00:31:36+09:00 Subject: Re: Static local variables for methods? But maybe you just want: def valid_attributes @__user_id ||= 0 @__user_id += 1 { :email => "some_#{@__user_id}@thing.com" } end This is simpler; just choose an instance variable name which is highly unlikely to clash with anything else. Of course, each instance of this object will have its own counter then. If that's not what you want, I'd use an instance variable within the class itself. -- Posted via http://www.ruby-forum.com/.