I don't understand, why eval works like this:
"123 #{456.to_s} 789" # => "123 456 789"
eval('123 #{456.to_s} 789') # => 123
How can I interpolate into a string inside eval?
Update:
Thank you, friends. It worked.
So if you have a string variable with #{} that you want to eval later, you should do it as explained below:
string = '123 #{456} 789'
eval("\"" + string + "\"")
# => 123 456 789
or
string = '123 #{456} 789'
eval('"' + string + '"')
# => 123 456 789
#{}sections, please , edit it in right way, I just don't know how to say it on english