Help with YAML, hashes, and design.


How do I convert a string value to a variable name? To get the value of the variable. Is the following technique good design?

I have an app that needs to create urls in a bunch of different formats. Below is a simplified example.

In my code, I've have variables first_name and last_name. So I put the mappings into a YAML file.

You can convert string to a Symbol and vice-versa. I don't think you can convert a string value to a variable name. Have you tried using string interpolation to solve your problem?

I was overcomplicating things before. Here is all I had to do: