add index function to Environment for variable access

This commit is contained in:
Josh Holtrop 2013-06-30 19:30:22 -04:00
parent 3ba3111a45
commit ea5ff789f2

View File

@ -41,6 +41,21 @@ module Rscons
@builders[builder_class.short_name] = builder_class
end
def [](key, type = nil)
val = @variables[key]
if type == :array and val.is_a?(String)
[val]
elsif type == :string and val.is_a?(Array)
val.first
else
val
end
end
def []=(key, val)
@variables[key] = val
end
def process
end