Answer the question
In order to leave comments, you need to log in
Ruby/ERB/puppet after comparison in if line becomes nil?
Greetings!
The following situation: I am writing an erb-template for pappet. The view is like this:
# XMX <%= xmx%><br/>
# XMX.class <%= xmx.class%><br/>
<%<br/>
mem = 4096.0<br/>
%><br/>
# MEM <%= mem%><br/>
# MEM.classs <%= mem.class%><br/>
<%<br/>
<br/>
if xmx == "NONE"<br/>
xmx = (mem * 0.7).to_s<br/>
%>XMX in if <%= xmx %> <%<br/>
else<br/>
%>XMX in else <%= xmx %> <%<br/>
end<br/>
%><br/>
# MEM <%= mem%><br/>
# MEM.class <%= mem.class%><br/>
# XMX <%= xmx%><br/>
# XMX.class <%= xmx.class%><br/>
# XMX NONE<br/>
# XMX.class String<br/>
<br/>
# MEM 4096.0<br/>
# MEM.classs Float<br/>
XMX in if 2867.2<br/>
# MEM 4096.0<br/>
# MEM.class Float<br/>
# XMX 2867.2<br/>
# XMX.class String
# XMX 1024<br/>
# XMX.class String<br/>
<br/>
# MEM 4096.0<br/>
# MEM.classs Float<br/>
XMX in else<br/>
# MEM 4096.0<br/>
# MEM.class Float<br/>
# XMX <br/>
# XMX.class NilClass<br/>
Answer the question
In order to leave comments, you need to log in
you have xmx calculated in one branch, not in the other
<%
if xmx == "NONE"
xmx = (mem * 0.7).to_s
else
end
%>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question