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

This commit is contained in:
josh committed 2013-06-27 21:19:13 -04:00
1 parent 46c50049aa
commit 975f6b06c8
1 file changed
+9 -2
+9 -2
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)