hacks/private_class_vars |
class Module < Object |
TODO: I'm not 100% convinced that this works as it should.
Example:
class Foo
private_class_var :foo
self.foo = 1
def xyz
# Don't use self.type.foo here, otherwise you will get the derived
# class's foo.
Foo.foo
end
end
f = Foo.new
p f.xyz #=> 1
p Foo.foo #=> (NameError)
Public Methods |
Define a new private class variable. The class variable will be accessible from the class with "self.symbol" and from instances of the class with "Class.symbol".
| symbol | the name of the private class variable. |
|---|---|
| initial_value | the initial value for the variable. |