我有一个这样的 erb 模板,我想直接将哈希对象转储到其中。
# test.yml.erb
---
name: <%= name || "bat" %>
director_uuid: <%= uuid %>
release:
name: bat
version: <%= release.name || "latest" %>
<%= YAML.dump(compilation) %>
update:
canaries: 1
canary_watch_time: 3000-90000
<%= YAML.dump(network)%>
但我ERB.new(test.yml.erb).result(binding)
只是得到这个:# test.yml --- name: bat director_uuid: uuid
release:
name: bat
version: lastest
---
compliaton:
workers: 1
network: default
update:
canaries: 1
canary_watch_time: 3000-90000
---
networks:
name: default
有没有办法删除不需要的---
?任何帮助,将不胜感激