-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nathan Olberding wrote:
> Mark Van Holstyn wrote:
> 
>>I think you problems is in the report class. Each time you do report =
>>Report.new, you won't be getting any data carried over from the last 
>>report
>>object. Is report.ID_list a method on the class? or on the instance? The
>>only way I can see it keeping data around is if you have some type of 
>>data
>>structure as a class variable, when you meant it to be an instance 
>>variable.
>>
>>mark
> 
> 
> Ah, this is a question I've had for a while. Last time I looked in to 
> it, I didn't find a real answer, but my code started working, so I ran 
> with it.
> 
> How do I define the difference between class variables and instance 
> variables? Class methods and instance methods?
> 
> Currently, all my methods for my classes are defined as:
> 
> def method_name()
> ...
> end

This is an instance method. It works on the instance of Report.

> 
> And my variables are all defined as:
> 
> @@var = ...

This is a class variable. All Reports will share this variable. You probably want to make it an instance variable with one @ symbols.

@var = ...

> 
> I couldn't figure out any other way to make variables available to 
> methods of the class they belonged to, but doing it this way worked 
> <shrug>.

For more information you may want to check out the Learn To Program book by Chris Pines. http://pine.fm/LearnToProgram/

Specfically http://pine.fm/LearnToProgram/?Chapter=09  nd scroll down to Instance Variables.

Zach





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFENpa7Myx0fW1d8G0RAtW+AJ9OK1RnQnuud/rbdbsUl7FU4fdroQCfeO9k
O6F5VO92CGpw/QSuX1sFB7U=
=wii5
-----END PGP SIGNATURE-----