From: "ara.t.howard" Date: 2008-05-07T08:38:08+09:00 Subject: Re: attr_accessor for class variable? On May 6, 2008, at 1:45 PM, Shot (Piotr Szotkowski) wrote: > Is this the canonical way to have config objects in applications? > > So far I’m stuck with > > > > module ArtDecomp class Config > > include Singleton > > attr_accessor :debug, :qu_method, :qv_method, :silicone > > def initialize > @debug = false > @qu_method = :graph_merger > @qv_method = :graph_merger > @silicone = Set[Arch[4,2], Arch[5,1]] > end > > def max_pins > @silicone.map{|arch| arch.pins}.max > end > > def max_pons > @silicone.map{|arch| arch.pons}.max > end > > def reset > initialize > end > > end end require 'configuration' # gem install configuration Configuration.for :art_decomp do qu_method :graph_merger qv_method :graph_merger end now simply require or load that file and you can use c = Configuration.for :art_decomp p c.qv_method http://codeforpeople.com/lib/ruby/configuration/configuration-0.0.5/README a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama