In Ruby, in the context of a class method, what are instance and class variables?
Posted
by J. Pablo Fernández
on Stack Overflow
See other posts from Stack Overflow
or by J. Pablo Fernández
Published on 2010-04-08T09:34:01Z
Indexed on
2010/04/08
9:43 UTC
Read the original article
Hit count: 219
ruby
If I have the following piece of Ruby code:
class Blah
def self.bleh
@blih = "Hello"
@@bloh = "World"
end
end
What exactly are @blih and @@bloh? @blih is an instance variable in the class Blah, and @@bloh is a class variable in the class Blah, correct? Does it mean that @@bloh is a variable in Blah's class, Class?
© Stack Overflow or respective owner