How to parse a .erb string and store the result on another string

Hi

Before diving on the seas of find-out-your-self
I though I’d venture a post.

given a string with valid .erb syntax such as

string=’<% who=world %> hello <%= who %>’

is there a way to parse it and obtain the result?

something like the imaginary method parse_erb

string.parse_erb
=> “hello world”

Anybody has a good idea on how to do this?

Thank you,

Andres

On Tue, 2008-07-29 at 16:55 -0600, andres wrote:

something like the imaginary method parse_erb

string.parse_erb
=> “hello world”

Anybody has a good idea on how to do this?

don’t worry,
looks a piece of cake
http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html