Environment.[]() allows specifying the type of variable you want returned

This commit is contained in:
Josh Holtrop 2013-06-27 21:19:13 -04:00
parent 46c50049aa
commit 975f6b06c8

View File

@ -34,8 +34,15 @@ module Rscons
end
end
def [](key)
@variables[key]
def [](key, type = nil)
val = @variables[key]
if type == :array
val.is_a?(String) ? [val] : val
elsif type == :string
val.is_a?(Array) ? val.first : val
else
val
end
end
def []=(key, val)