如何在方法中传递嵌套哈希?这是一个示例代码
MONOPOLY_GAME = {
deeds:
{
boardwalk:
{
price: 400,
rent: 50
},
atlantic:
{
price: 260,
rent: 22
},
baltic:
{
price: 60,
rent: 4
}
}
}
def rent_for(p)
return MONOPOLY_GAME[:deeds][:p][:rent]
end
rent_for(:boardwalk)
rent_for(:atlantic)
rent_for(:baltic)