Project

General

Profile

Bug #14215 ยป result_with_hash.patch

ota42y (ota ota), 12/21/2017 10:54 AM

View differences:

lib/erb.rb
# by a Hash object.
def result_with_hash(hash)
b = new_toplevel
backup = {}
news = []
hash.each_pair do |key, value|
if b.local_variable_defined?(key)
backup[key] = b.local_variable_get(key)
else
news << key
end
b.local_variable_set(key, value)
end
ret = result(b)
backup.each_pair do |key, value|
b.local_variable_set(key, value)
end
result(b)
news.each { |key| b.local_variable_set(key, nil) }
ret
end
##
    (1-1/1)