Environment.[]() allows specifying the type of variable you want returned
This commit is contained in:
1 parent
46c50049aa
commit
975f6b06c8
1 file changed
+9
-2
@@ -34,8 +34,15 @@ module Rscons
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def [](key)
|
def [](key, type = nil)
|
||||||
@variables[key]
|
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
|
end
|
||||||
|
|
||||||
def []=(key, val)
|
def []=(key, val)
|
||||||
|
|||||||
Reference in new issue
Block a user