From: Jim Freeze Date: 2003-05-09T08:37:41+09:00 Subject: Re: Can a global be a constant? On Friday, 9 May 2003 at 8:23:52 +0900, Hal E. Fulton wrote: > > Not a stupid question... maybe my assumptions > don't work for you, but what I was thinking > was something like: > > class State > @@debug = nil > @@verbose = nil > > def State.debug > @@debug > end > > def State.debug=(val) > @@debug = val > end > > def State.verbose > @@verbose > end > > def State.verbose=(val) > @@verbose = val > end > > class App > def main > State.debug = true > State.verbose = false > Work.new > end > end > > class Work > def initialize > puts State.debug > end > end > > App.new.main > > > Hal Yes. That is the truly global solution. I was trying to do that but was getting lost somewhere. Is there a neater (read more concise) way to define State with maybe a << class_attr_accessor maybe? A couple of requirements that would be nice: 1) Only the creator of the state can change it 2) Classes at most have to do an include to get access to the state. -- Jim Freeze ---------- VMS is like a nightmare about RSX-11M.