Topic: Converting a stringify path into a recursive hash
hi everybody,
Is somebody able to suggest me a way to do this ? ( all is in the subject
)
what I want is using a "path" and tranform it as a suit of sub key,
e.g. : I have that params: path = "earth/animal/human/men/young/" value = "martin"
and I want : Global_hash = { earth => { human => { men => { young => "martin"
}
}
}
}
path = "earth/animal/human/men/old/" value = "John"
and I want : Global_hash = { earth => { human => { men => { young => "martin",
old => "John"
}
}
}
}
The final goal is a way to produce yml file with 2 parameters :
the path and the value
it will allow us to have a yml file with all object sort by sections thanks to their path.
Thanks per advance
Last edited by Tnecniv-Eiluj (2012-07-12 18:59:07)