add index function to Environment for variable access
This commit is contained in:
1 parent
3ba3111a45
commit
ea5ff789f2
1 file changed
+15
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user