From: Phillip Gawlowski Date: 2010-11-10T02:20:51+09:00 Subject: Re: YAML dependency On Tue, Nov 9, 2010 at 4:02 PM, Guilherme Mello wrote: > Hi, > > I'm creating a Gem and the code uses data from a YAML file: > > CONFIG = YAML.load_file("config/file.yml")["development"] > > This code is fixed in the class and located at Rails.root/config. The > Gem looks to that path and loads the YAML. > > The question is: How allow the user to set what environment will be used > outside of Gem ? Don't hard code the pathname, instead provide a default filename if myinstance = YourClass.new # or whatever makes sense for your gem doesn't pass a valid filename. Or check if you are running in Rails, and then supply a default filename, or... -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.