📜  ruby hash除了嵌套 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:10.009000             🧑  作者: Mango

代码示例1
Hash[nested_hash.map {|k,v| [k,(v.respond_to?(:except)?v.except("nested_key2"):v)] }]

=> {"key1"=>"value1", "key2"=>{"nested_key1"=>"nestedvalue1"}}