From: Joel VanderWerf Date: 2006-10-25T04:17:57+09:00 Subject: Re: How to maintain App config data? Nate Wiger wrote: > I'm writing an app in Rails, but some modules need to work outside of > Rails. In these classes, I'd like to have a common way to access > configuration data. Two approaches I though of: > > 1. Use a Singleton class ala the Logger concept, and have > a "conf" object floating around that can provide the > "conf.root_dir" or whatever > > 2. Mixin a module that provides a conf() routine, so that > classes would call conf('root_dir') / etc > > > Opinions? In the Perl world, I would use Config::Fast and attach a > $self->{conf} hashref to my classes, which all point to a shared object. This was developed for GUI (specifically FXRuby) apps, but would probably work with any kind of app: http://raa.ruby-lang.org/project/preferences/ -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407