Dominik Honnef wrote:
> On [Tue, 03.03.2009 23:58], Daniel Schoch wrote:
>> > constants like __FILE__ or simply global variables?
>>  s = "x/test/y.z"
>> 
>> 
> | >>> DIR=x FILE=y.z irb
> | >> s = "$DIR/test/$FILE".gsub(/\$\w+/) {|m| ENV[m[1..-1]]}
> | => "x/test/y.z"
> 
> Thats how I would do it.

Or: s = "$DIR/test/$FILE".gsub(/\$(\w+)/) { ENV[$1] }
-- 
Posted via http://www.ruby-forum.com/.