提问人:Andrew Grimm 提问时间:1/3/2012 更新时间:1/3/2012 访问量:255
使用 Ruby 在 YAML 哈希中使用浮点数是否安全?
Is it safe to use floats in YAML hashes with Ruby?
问:
如果我有一个像这样的 YAML 文件
---
2.1: my product version
没有任何引号,Ruby 会将其视为 Float(至少在 Syck 下 - 我不确定 Psych)。2.1
使用 Float 作为哈希键是否有任何风险,只要该键的所有其他出现都来自 YAML 文件或来自 Ruby 的文字?
答: 暂无答案
评论
[2,1,11]
2.1.11
Hash
RBTree
'@9.884112959068247e-09' is not allowed as an instance variable name