说我有:
h = {}
h[["one", "two"]] = "three"
# h = {["one", "two"]=>"three"}
如何在YAML中表示上述哈希,以便YAML.load_file('that_file')
正确加载h
哈希?
答案 0 :(得分:2)
您可以使用to_yaml
方法预览:
h = {}
h[["one", "two"]] = "three"
h.to_yaml
# => "---\n? - one\n - two\n: three\n"