Find special text and transform it in a variable name

Hello !
I’m completely stuck here. I’ve been reading the Ruby documentation from
side to side on regexp and string but I could not manage to find an
answer.
so I’m Using a .txt file
inside it is written :

Blablabla #{$class.method}.

When I import it the text is converted into a string and it displays
exactly what is written.
How can I do to make it automatically replace #{$class.method} by the
real text returned by $class.method?

Thank you for your time.

Baptiste j. wrote in post #1071606:

Blablabla #{$class.method}.

This be ok : put guillemet on each side of the content :

eval(’"’+File.read(filename)+’"’)

I didn’t think about eval()! Thank you!

Hi,

Please don’t do this, it’s a really horrible hack.

I guess what you’re looking for is a kind of template engine.