Here is some example code that I have tested in my submit.yml.erb. First it asserts that gpus is not nil, and then it passes gpus into a function, and then that function asserts again that it is not nil.
<%
def foo(x)
if x.nil?
raise Exception.new("x is nil!")
end
return x
end
if gpus.nil?
raise Exception.new("gpus is nil!")
end
gpus = foo(gpus)
%>
The outer assertion passes, and the inner assertion fails.
If I change the last line from gpus = foo(gpus) to something_else = foo(gpus), both assertions pass.
Is it illegal in Ruby to use a variable in an expression and then overwrite the variable in the same line?