有人能建议我这样做的方法吗?(所有都在主题:D)
我想要的是使用"路径"并将其转换为子键,
例如:我有那个参数:path ="earth/animal/human/men/young /"value ="martin"我希望:
`Global_hash = { earth => { human => { men => { young => "martin"
}
}
}
}`
Run Code Online (Sandbox Code Playgroud)
path ="earth/animal/human/men/old /"value ="John",我想:
Global_hash = { earth => { human => { men => { young => "martin",
old => "John"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
加上另一个
path ="earth/animal/human/women/old /"value ="Eve",我想:
`Global_hash = { earth => { human => { men => { young => "martin",
old => "John"
},
women => { old => …Run Code Online (Sandbox Code Playgroud)