我在食谱的节点文件中有一个验证列表
"normal": {
"Data_list": 'one, two, three, four',
"tags": [
]
}
基于此列表,我想向模板添加值,下面是相同的源代码,但它似乎不是运行 case 和 if 语句,而是将模板中的所有逻辑作为简单文本添加。
<%= [node['data_list']].each do |data|
case data
when 'one'
"this is one and this will be added in template"
when 'two'
"this is two and this will be added in template"
when 'three'
"this is three and this will be added in template"
when 'four'
"this is four and this will be added in template"
default
"this is default and this will be added in template"
end
end %>
任何帮助确定我做错了什么都会很有帮助