在 Ruby 的 YAML 哈希中使用浮点数是否安全?
如果我有一个没有任何引号的 YAML 文件
---
2.1: my product version
,Ruby 会将 2.1
视为 Float(至少在 Syck 下 - 我不确定 Psych)。
只要该键的所有其他出现都来自 YAML 文件或来自 Ruby 的文字,使用 Float 作为哈希键是否存在任何风险?
If I have a YAML file like
---
2.1: my product version
without any quotation marks, Ruby will treat the 2.1
as a Float (at least under Syck - I'm not sure about Psych).
Are there any risks in using a Float as a hash's key, so long as all of the other occurences of the key are either from a YAML file or literals from Ruby?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论