How would I go about searching this hash of hashes for a wine growing region for the final branch of the tree for the key of Vista Flores
.
{
"Argentina": {
"Catamarca": [],
"Cuyo": [],
"Fiambala": [],
"Jujuy": [],
"La Rioja": {
"Famatina": []
},
"Mendoza": {
"Agrelo": [],
"Barrancas": [],
"Las Compuertas": [],
"Lujan de Cuyo": [],
"Lunlunta": [],
"Maipu": [],
"Perdriel": [],
"San Martin": [],
"San Rafael": [],
"Uco Valley": {
"Altamira": [],
"La Consulta": [],
"San Carlos": [],
"Tunuyan": [],
"Tupungato": [],
"Vista Flores": []
},
"Ugarteche": [],
"Vistalba": []
},
"Patagonia": {
"Neuquen": [],
"Rio Negro": []
},
"Salta": {
"Cafayate - Calchaqui Valley": [],
"Molinos": []
},
"San Juan": {
"Pedernal Valley": [],
"Tulum Valley": [],
"Zonda Valley": []
}
}
}
Once I have that region I then need to recurse back up the tree and build up the tree structure such as:
region_1: Argentina
region_2: Mendoza
region_3: Uco Valley
region_4: Vista Flores
Please know that this is not homework, but rather a real problem I am facing. I am quiet awful at recursion problems such as these.
You can see a previous question that I have asked on the ruby irc before - here