From: "David A. Black" Date: 2008-12-05T05:15:03+09:00 Subject: Re: or = for a constant Hi -- On Fri, 5 Dec 2008, Bob Archer wrote: > Hello, > > > > I want to set a constant to be the value from an env variable or if that > is not there set it to the current directory. > > > > So, I am doing this: > > > > WORKINGDIR = ENV['CCNetWorkingDirectory'] ? ENV['CCNetWorkingDirectory'] > : "." > > > > But it doesn't seem very Ruby/DRY like. > > > > Is there a better way to do this? WORKINGDIR = ENV['CCNetWorkingDirectory'] || "." David -- Rails training from David A. Black and Ruby Power and Light: INTRO TO RAILS (Jan 12-15), Fort Lauderdale, FL See http://www.rubypal.com for details Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)