I have a string:
parsed[tag] => "first_name: 'Richard'"
I need to execute code that looks like this:
client.put_if_absent("profiles", bot_client_name, {first_name: 'Richard'})
Is it possible I can use that first string to somehow act as code for the equivalent text? I tried using eval(parsed[tag])
but that was a fail.
I changed to the following:
response = "client.put_if_absent('profiles', bot_client_name, {#{parsed[tag]}})"
eval(response)
This actually works --- what can I do to reduce potential risks?