如何使用 Psych 在 YAML 文档中发出评论? [英] How can I emit comments in a YAML document using Psych?

查看:17
本文介绍了如何使用 Psych 在 YAML 文档中发出评论?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想生成一个 YAML 文档,其中包含序列元素之间的一些注释,但我真的不知道该怎么做.有什么指点吗?

I want to generate a YAML document with some comments between sequence elements but I can't really figure out how to do this. Any pointers?

推荐答案

您不能使用 Psych 发出包含注释的 YAML 文档.Psych 基本上是转储一个 Hash,你也不能在 Hash 中进行评论.

You can’t emit YAML documents containing comments with Psych. Psych basically dumps a Hash, and you can’t have comments in a Hash either.

这篇关于如何使用 Psych 在 YAML 文档中发出评论?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆