Sam 山
Sam 山

Reputation: 42863

What is the point of Ruby's @@double_at_variable?

I rarely use the @@double_at_variable, don't even know what to call it. When I dig into gems and os projects I usually come across this variable and it throws me for a loop.

What does it do that the other ruby variables cannot achieve and what is usually the application in projects such as Rails?

Upvotes: 0

Views: 182

Answers (1)

Pablo Fernandez
Pablo Fernandez

Reputation: 105258

The double @ variables are class variables.

That means, there is only one of them per class unlike common instance variables (one per object)

Upvotes: 5

Related Questions