Bug #14215 ยป result_with_hash.patch
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
|
||
##
|