From: Jim Freeze Date: 2003-05-09T09:05:30+09:00 Subject: Re: Can a global be a constant? On Friday, 9 May 2003 at 8:57:15 +0900, dblack@superlink.net wrote: > Hi -- > > On Fri, 9 May 2003, Jim Freeze wrote: > > > On Friday, 9 May 2003 at 8:23:52 +0900, Hal E. Fulton wrote: > > > > > > 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 > > > > Is there a neater (read more concise) way to define State with > > maybe a << class_attr_accessor maybe? > > You can use instance variables (of the object State) instead of class > variables, and then State becomes: > > class State > class << self > attr_accessor :debug, :verbose > end > end Why does this not define the class method State.debug to set the instance variable @debug? > > (though this does not deal with the requirements you list later...) > Is that requirements list even possible? -- Jim Freeze ---------- Half Moon tonight. (At least it's better than no Moon at all.)