calling eruby from code?

X

Xavier Noria

I've found documentation for running eruby(1) from the command line and
for configuring Apache to handle eruby templates. Do you know how to
process templates from within Ruby code?

Just to be explicit, the idea would be for example to instantiate an
eruby template engine as a Ruby object, pass to it an eruby template as
a string, pass to it in addition a handful of Ruby objects used in the
template, and have the engine process all the stuff and, say, return
the result as a string.

Is that possible? If not, would you recommend some other framework?

fxn
--
s;$;Barcelona Perl Mongers;;$/=$||gaudi||3;map$,+=(split//)*(-1)**$|++,
(split)[.11_09,1.714];$.=$!!~m~erce~;$"=y~catalunya~~,$;=y~rambles~~,$*
=$/^$.;$:=$.+length,$@=$***$**$/**$*%$:,$%=$/*$"-$*;print+chr($_<0xA?$.
."$[$_":m:^$.:?"$.$_":$_)for($**($**$%-$//$/),$%-$*,$,*$/,$***$***$*,$*
**$,,$"*$@+$**$/,$**$,,$;,$***$***$*,$***$*,$.,$**$",$***$,,$***$***$**
$,,$.,$"*$*,$"+$.,$***$,,$,-$.,$"*$@+$**$/,$;*$/**$*,$",$.,++$@+by_fxn)
 
J

John W. Long

I've found documentation for running eruby(1) from the command line and
for configuring Apache to handle eruby templates. Do you know how to
process templates from within Ruby code?

Just to be explicit, the idea would be for example to instantiate an
eruby template engine as a Ruby object, pass to it an eruby template as
a string, pass to it in addition a handful of Ruby objects used in the
template, and have the engine process all the stuff and, say, return
the result as a string.

Is that possible? If not, would you recommend some other framework?

Yes it is possible. Take a look at the "apache/eruby-run.rb" file. This ruby
handler for rhtml files demonstrates how to do exactly what you want.
___________________
John Long
www.wiseheartdesign.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top