[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: metaprogramming surprise?

Gavin Kistner

10/17/2006 4:17:00 PM

Artur Merke wrote:
> class A
> @@class_variable
> @class_instance_variable
> def initialize
> @instance_variable
> end
> end
>
> I hope this is the correct naming for this variables

That's the way I think of them, too. It might help you to remember that
instance variables are just instance variables, regardless of where they
are stored. "Class instance variables" are just normal instance
variables that happen to be stored on a Class object. Nothing special
about them.

2 Answers

J2M

10/17/2006 5:20:00 PM

0

To achieve what you were trying you may want to look at the class
extensions in rails where there are simple class level accessors and
inheritable_class accessors that give each inherited class it's own
copy of the accessors from the parent class.

http://dev.rubyonrails.org/svn/rails/branches/stable/activesupport/lib/active_support/core_...


Ara.T.Howard

10/17/2006 5:33:00 PM

0