2011-01-19 102 views
0

我正在使用Ruby 1.9.2和Rails 3.0.1,我收到了YAML的奇怪問題。這裏是我的YAML文件:YAML Ruby 1.9.2:停止添加Syck :: MergeKey對象到我的哈希

#config/tags_constants.yml 
:main_ingredients: &ingredients 
    - Beans 
    - Beef 
    - Cheese 
    - Chocolate 
    - Dairy 
    - Eggs 
    - Fish 
    - Fruits 
    - Game 
    - Lamb 
    - Nuts 
    - Pasta 
    - Pork 
    - Poultry 
    - Rice/Grains 
    - Shellfish 
    - Tofu/Soy 
    - Vegetables 

:excluded_ingredients: 
<<: *ingredients 

以下是我在控制檯是送走:

> hash = YAML.load(File.open("config/tags_constants.yml")) 
> hash["excluded_ingredients"] 
=> {#<Syck::MergeKey:0x00000101b379d0>=>["Beans", "Beef", "Cheese", "Chocolate", "Dairy", "Eggs", "Fish", "Fruits", "Game", "Lamb", "Nuts", "Pasta", "Pork", "Poultry", "Rice/Grains", "Shellfish", "Tofu/Soy"]} 

如何獲得YAML不添加這些奇怪的SYCK :: MergeKey對象合併值是多少?

+0

如果回答您以前的問題已經解決了你的問題,你可能希望通過單擊旁邊的刻度標記爲「接受」他們。 – 2011-04-10 23:03:55

回答

1

嘗試以下操作:

client: &client 
    - Brad 
    - Angelina 
:development: 
    :requests: 1 
    :client: 
    :session: "something" 
    :paths: 
     *client