lib/sapluuna/context.rb in sapluuna-0.1.6 vs lib/sapluuna/context.rb in sapluuna-0.1.7
- old
+ new
@@ -43,10 +43,11 @@
def import file
template = File.read resolve_file(file)
@opts[:variables] = @variables
@opts[:root_directory] = @root_directory.dup
+ @opts[:discover_variables] = @discover_variables
Log.debug "importing #{file}"
sapl = Sapluuna.new @opts
output = sapl.parse template
@discovered_variables.merge! sapl.discovered_variables
add_indent output.lines, @output.lines.last
@@ -71,12 +72,12 @@
def method_missing method, *args
if Array === args.first
value = args.first.last
case args.first.first
when :is
- @variables[method] = value unless @variables[method]
+ @variables[method] ||= value
when :are
- @variables[method] = value.to_s.strip.split(/\s+/) unless @variables[method]
+ @variables[method] ||= value.to_s.strip.split(/\s+/)
end
""
elsif @variables[method]
@variables[method]
else