Im trying to execute inline ruby from a string. The string is stored in a database as a text and is not made using ruby.
string = 'The year now is #{Time.now.year}'
puts string
That returns
=> The year now is #{Time.now.year}
I want it to return
=> The year now is 2015
Is there any method in ruby that will execute inline ruby like that?
#{part appropriately. And you will gain the safety from ERB as well.