From fbdc773abb60042c1c5b6fac86dccf0a672c6da0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 26 Jun 2013 22:07:23 -0400 Subject: [PATCH] expand variable lists with prefix/suffix elements --- lib/rscons/environment.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/rscons/environment.rb b/lib/rscons/environment.rb index d90ca8f..d8dc7ae 100644 --- a/lib/rscons/environment.rb +++ b/lib/rscons/environment.rb @@ -55,7 +55,16 @@ module Rscons expand_varref.call(ent) end else - if varref[0] == '$' + if varref =~ /^(.*)\$\[(\w+)\](.*)$/ + # expand array with given prefix, suffix + prefix, varname, suffix = $1, $2, $3 + varval = merged_variables[varname] + unless varval.is_a?(Array) + raise "Array expected for $#{varname}" + end + varval.map {|e| "#{prefix}#{e}#{suffix}"} + elsif varref[0] == '$' + # expand a single variable reference varname = varref[1, varref.size] varval = merged_variables[varname] if varval