From: dblack@... Date: 2003-05-09T09:01:35+09:00 Subject: Re: Can a global be a constant? Hi -- On Fri, 9 May 2003, Jim Freeze wrote: > On Friday, 9 May 2003 at 8:16:04 +0900, dblack@superlink.net wrote: > > Hi -- > > > > Would this be suitable? > > > > class App > > class << self > > attr_reader :state > > end > > State = Struct.new(:debug, :verbose) > > @state = State.new(true, false) > > def main > > Work.new > > end > > end > > > > class Work > > def initialize > > puts App.state.debug > > end > > end > > > > App.new.main > > > Close. > Now, realize, I'm just now learning about this > weird class << self stuff. Is that just a fancy > way of doing: > class App > def self.state; @state; end > end No, it's actually a simpler way :-) (using attr_reader instead of writing the method manually) David -- David Alan Black home: dblack@superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav