From: Alex Young Date: 2007-08-17T01:25:36+09:00 Subject: Re: Does singleton variables have any meaning ? Arno J. wrote: > Hello, > > I would like to have a confirmation about the fact that singleton > variables just don't have any meaning, or an explation about how to use > them. > An example to be sure that we are talking about the same thing : > > class A > > @class_instance_variable > > class << self #or class << A > > @singleton_variable # <- Can this be used/called elsewhere ? > > def some_method > @class_instance_variable > end > > end > > end > > Thanks class A class << self @singleton_variable attr_accessor :singleton_variable # <----- N.B. end end irb(main):035:0> A.singleton_variable = :foo => :foo irb(main):037:0> A.singleton_variable => :foo That's how I use them... -- Alex