Với băm như vậy với băm lồng nhau trong Ruby (sâu có thể thay đổi):Sâu xóa từ Ruby băm bằng con đường rải rác
hash = {"status_message"=>
{ "destination_does_not_exist"=>
{"message_header" => "Zielordner existiert nicht",
"message_body" => "Der Zielordner für das Backup existiert nicht mehr.",
"corrective_action" => "Erstellen Sie den Zielordner."
}
}
}
Làm thế nào tôi có thể xóa key và tất cả các con của nó giá trị sử dụng đơn giản "chấm" ký hiệu? Cái gì như:
path = "status_message.destination_does_not_exist.message_header"
hash.delete!(path)
có thể trùng lặp của http://stackoverflow.com/questions/6423484/how-do-i-convert-hash-keys-to-method-names –