From: Nit Khair Date: 2008-10-09T04:04:37+09:00 Subject: Re: Suggestions for common/global data in app (cli) Brian Candler wrote: > >> Would these files (yaml, load) have to loaded in each program? > > Yes, assuming these programs are separate (e.g. separate commands > invoked from the command line) as they will get a fresh Ruby interpreter > instance. > >> I have heard of global vars but never used. > > That would be just another way to refer to the loaded data. You could > write: > > require "yaml" > $config = YAML.load("/etc/myapp.conf") > > and then anywhere else in your program you could say > > $config["db_user"] > Small question. The app is not separate programs loaded from the command line. The main menu loads, then other classes available in other files are required and instantiated. So there are many separate files, but one ruby interpreter. Will "$config["XXX"] work through all the programs ? That seems fairly easy. Will look into dep inj soon - thanks for the tip. -- Posted via http://www.ruby-forum.com/.