I have no actual use case and I believe there will be not many save
for metaprogramming, meta-meta programming maybe ;)
517/18 > cat singvar.rb && ruby singvar.rb
class A
@a = 42
class << self
@a = 222
def class_inst; @a end
def sing_inst; class << self; self end.instance_variable_get("@a") end
end
end
puts A.class_inst
puts A.sing_inst
42
222
Cheers
Robert
--
[...] as simple as possible, but no simpler.
-- Attributed to Albert Einstein