Bill Atkins
1/12/2005 4:29:00 PM
Try mounting HTTPServlet::ERBHandler instead of
HTTPServlet::FileHandler. It should run ERB on anything in the
directory it's mounted on.
Bill
On Thu, 13 Jan 2005 01:18:50 +0900, Belorion <belorion@gmail.com> wrote:
> Thank you for the quick response!
>
> Does there exist Webrick support for handling .rhtml files the way
> eruby/mod_ruby does?
>
> Matt
>
> On Thu, 13 Jan 2005 01:12:55 +0900, David A. Black <dblack@wobblini.net> wrote:
> > Hi --
> >
> > On Thu, 13 Jan 2005, Belorion wrote:
> >
> > > Serving up html works fine. However, serving up .rhtml does not work.
> > > If I visit my test.rhtml, whose contents are:
> > >
> > > <html><head></head><body>
> > > testing, 1234
> > > <%
> > > 10.times{ |i| puts i }
> > > %>
> > > </body></html>
> > >
> > > All I get as output on my browser is "testing, 1234", whose source looks like
> > > <html><head></head><body>
> > > testing, 1234
> > > </body></html>
> > >
> > > At the command prompt, if I ruby "erb test.rhtml" I get:
> > >
> > > 0
> > > 1
> > > 2
> > > 3
> > > 4
> > > 5
> > > 6
> > > 7
> > > 8
> > > 9
> > > <html>
> > > <head>
> > > </head>
> > > <body>
> > > testing, 1234
> > >
> > >
> > > </body>
> > > </html>
> > >
> > > Which is obviously incorrect. What am I doing wrong here? I am using
> > > ruby 1.8.2 (2004-07-29), and erb 2.0.4.
> >
> > You need <%= %> rather than <% %>. But keep in mind that what erb
> > will show you is the result of evaluating the expression. The result
> > of evaluating 10.times {...} is 10 -- and the result of evaluating
> > puts is nil. So if you want to display all the numbers, you'd want
> > something like:
> >
> > <%= (1..10).to_a.join(", ") %>
> >
> > David
> >
> > --
> > David A. Black
> > dblack@wobblini.net
> >
> >
>
>
--
$stdout.sync = true
"Just another Ruby hacker.".each_byte do |b|
('a'..'z').step do|c|print c+"\b";sleep 0.007 end;print b.chr
end; print "\n"