From: "Iñaki Baz Castillo" Date: 2008-06-28T00:23:56+09:00 Subject: Re: Is it ellegant to use a global variable to store a Logger object? El Viernes, 27 de Junio de 2008, Shot (Piotr Szotkowski) escribió: > module ArtDecomp class Config > > class << self > >   attr_accessor :debug, :processes, :qu_method, :qv_method, :silicone > >   def init >     @debug     = false >     @processes = 1 >     @qu_method = :graph_merger >     @qv_method = :graph_merger >     @silicone  = Set[Arch[4,2], Arch[5,1]] >   end > >   def log string, run, runs, dawn >     left = ((Time.now - dawn)/run*(runs - run)).ceil >     $stderr << " [#{string} #{runs - run} #{left}s] " if Config.debug >   end > >   def max_pins >     @silicone.map{|arch| arch.pins}.max >   end > >   def max_pons >     @silicone.map{|arch| arch.pons}.max >   end > >   alias reset init > > end > > end end > > ArtDecomp::Config.init The only I don't like about the above code is the need of using .init method explicitely. It could be nice if "initialize" would also work automatically in some way, is not possible? (of course I understand that we are not creating an instance here). Thanks a lot. -- Iñaki Baz Castillo