In PHP, it is possible to do this:
\">
Is it possible to embed Rub
Rails has something called ERB to do just this sort of thing.
You will need to use a templating engine like Ruby Templates (ERB). Here's an example. Rails uses ERB so you could easily do this in each of your templates.
Use HAML for HTML templating, otherwise ERB.